2016-09-08 21:13:10 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
2017-11-14 03:36:14 +04:00
|
|
|
(* Copyright (c) 2014 - 2017. *)
|
2016-09-08 21:13:10 +04:00
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
2016-10-06 14:55:38 +04:00
|
|
|
(** Tezos - Versioned, block indexed (key x value) store *)
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
(** A block-indexed (key x value) store directory. *)
|
|
|
|
type index
|
|
|
|
|
|
|
|
(** A (key x value) store for a given block. *)
|
2017-02-24 20:17:53 +04:00
|
|
|
type t
|
|
|
|
type context = t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2016-10-06 14:55:38 +04:00
|
|
|
(** Open or initialize a versioned store at a given path. *)
|
2016-09-08 21:13:10 +04:00
|
|
|
val init:
|
2017-02-24 20:17:53 +04:00
|
|
|
?patch_context:(context -> context Lwt.t) ->
|
2016-09-08 21:13:10 +04:00
|
|
|
root:string ->
|
|
|
|
index Lwt.t
|
|
|
|
|
2017-02-24 20:17:53 +04:00
|
|
|
val commit_genesis:
|
|
|
|
index ->
|
2017-07-17 17:59:09 +04:00
|
|
|
net_id:Net_id.t ->
|
2017-02-24 20:17:53 +04:00
|
|
|
time:Time.t ->
|
|
|
|
protocol:Protocol_hash.t ->
|
2017-12-05 18:17:54 +04:00
|
|
|
Context_hash.t Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-04-10 23:14:17 +04:00
|
|
|
val commit_test_network_genesis:
|
2017-07-17 17:59:09 +04:00
|
|
|
index -> Block_hash.t -> Time.t -> context ->
|
2017-12-05 18:17:54 +04:00
|
|
|
(Net_id.t * Block_hash.t * Context_hash.t) tzresult Lwt.t
|
2017-04-10 23:14:17 +04:00
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
(** {2 Generic interface} ****************************************************)
|
|
|
|
|
2017-11-15 16:06:41 +04:00
|
|
|
type key = string list
|
|
|
|
type value = MBytes.t
|
|
|
|
|
|
|
|
val mem: context -> key -> bool Lwt.t
|
|
|
|
val dir_mem: context -> key -> bool Lwt.t
|
|
|
|
val get: context -> key -> value option Lwt.t
|
|
|
|
val set: context -> key -> value -> t Lwt.t
|
|
|
|
val del: context -> key -> t Lwt.t
|
|
|
|
val remove_rec: context -> key -> t Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-11-15 19:20:08 +04:00
|
|
|
val fold:
|
|
|
|
context -> key -> init:'a ->
|
|
|
|
f:([ `Key of key | `Dir of key ] -> 'a -> 'a Lwt.t) ->
|
|
|
|
'a Lwt.t
|
|
|
|
|
|
|
|
val keys: context -> key -> key list Lwt.t
|
|
|
|
val fold_keys:
|
|
|
|
context -> key -> init:'a -> f:(key -> 'a -> 'a Lwt.t) -> 'a Lwt.t
|
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
(** {2 Accessing and Updating Versions} **************************************)
|
|
|
|
|
2017-12-05 18:17:54 +04:00
|
|
|
val exists: index -> Context_hash.t -> bool Lwt.t
|
|
|
|
val checkout: index -> Context_hash.t -> context option Lwt.t
|
|
|
|
val checkout_exn: index -> Context_hash.t -> context Lwt.t
|
2017-04-10 14:14:11 +04:00
|
|
|
val commit:
|
|
|
|
time:Time.t ->
|
|
|
|
message:string ->
|
2017-07-17 17:59:09 +04:00
|
|
|
context ->
|
2017-12-05 18:17:54 +04:00
|
|
|
Context_hash.t Lwt.t
|
|
|
|
val set_head: index -> Net_id.t -> Context_hash.t -> unit Lwt.t
|
|
|
|
val set_master: index -> Context_hash.t -> unit Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
(** {2 Predefined Fields} ****************************************************)
|
|
|
|
|
2017-02-24 20:17:53 +04:00
|
|
|
val get_protocol: context -> Protocol_hash.t Lwt.t
|
|
|
|
val set_protocol: context -> Protocol_hash.t -> context Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
val get_test_network: context -> Test_network_status.t Lwt.t
|
|
|
|
val set_test_network: context -> Test_network_status.t -> context Lwt.t
|
|
|
|
|
2017-02-24 20:17:53 +04:00
|
|
|
val del_test_network: context -> context Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-04-10 23:14:17 +04:00
|
|
|
val reset_test_network: context -> Block_hash.t -> Time.t -> context Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-04-10 23:14:17 +04:00
|
|
|
val fork_test_network:
|
|
|
|
context -> protocol:Protocol_hash.t -> expiration:Time.t -> context Lwt.t
|
2017-07-17 17:59:09 +04:00
|
|
|
val clear_test_network: index -> Net_id.t -> unit Lwt.t
|