Add check of snapshot availability
This commit is contained in:
parent
cd30ff95e7
commit
c92f370930
@ -11,6 +11,7 @@ type error +=
|
|||||||
| Consume_roll_change
|
| Consume_roll_change
|
||||||
| No_roll_in_contract
|
| No_roll_in_contract
|
||||||
| Deleted_contract_owning_rolls
|
| Deleted_contract_owning_rolls
|
||||||
|
| No_roll_snapshot_for_cycle of Cycle_repr.t
|
||||||
|
|
||||||
let get_contract_delegate c contract =
|
let get_contract_delegate c contract =
|
||||||
match Contract_repr.is_default contract with
|
match Contract_repr.is_default contract with
|
||||||
@ -81,6 +82,8 @@ module Random = struct
|
|||||||
| Some delegate ->
|
| Some delegate ->
|
||||||
return delegate
|
return delegate
|
||||||
in
|
in
|
||||||
|
Storage.Roll.Owner.snapshot_exists c cycle >>= fun snapshot_exists ->
|
||||||
|
fail_unless snapshot_exists (No_roll_snapshot_for_cycle cycle) >>=? fun () ->
|
||||||
loop sequence
|
loop sequence
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -274,6 +274,9 @@ module Make_indexed_data_snapshotable_storage (C : Raw_context.T)
|
|||||||
|
|
||||||
let snapshot_path id = snapshot_name @ Snapshot_index.to_path id []
|
let snapshot_path id = snapshot_name @ Snapshot_index.to_path id []
|
||||||
|
|
||||||
|
let snapshot_exists s id =
|
||||||
|
C.dir_mem s (snapshot_path id)
|
||||||
|
|
||||||
let snapshot s id =
|
let snapshot s id =
|
||||||
C.copy s ~from:data_name ~to_:(snapshot_path id) >>=? fun t ->
|
C.copy s ~from:data_name ~to_:(snapshot_path id) >>=? fun t ->
|
||||||
return (C.project t)
|
return (C.project t)
|
||||||
|
@ -152,6 +152,7 @@ module type Indexed_data_snapshotable_storage = sig
|
|||||||
and type value = value
|
and type value = value
|
||||||
and type t = t
|
and type t = t
|
||||||
|
|
||||||
|
val snapshot_exists : context -> snapshot -> bool Lwt.t
|
||||||
val snapshot : context -> snapshot -> Raw_context.t tzresult Lwt.t
|
val snapshot : context -> snapshot -> Raw_context.t tzresult Lwt.t
|
||||||
val delete_snapshot : context -> snapshot -> Raw_context.t Lwt.t
|
val delete_snapshot : context -> snapshot -> Raw_context.t Lwt.t
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user