Tezos_context_ops.Context_opstype t = Tezos_protocol_environment.Context.ttype block_cache = Tezos_protocol_environment.Context.block_cachedo_not_use__is_duo index returns true if the index is in duo mode
This function should not be used in "normal" code as it is used when the duo mode is enabled. The duo mode is a debug mode used to compare Irmin and Brassaia.
Making any assumption about the internals of context_ops is a unforgivable mistake
Environment variable allowing to chose the context provider (Irmin/Brassaia/Duo)
context_dir ?envvar root returns the context's directory concatenated to root depending on the backend that was chosen with TEZOS_CONTEXT_BACKEND
Example:
context_dir "/tmp/" returns "/tmp/context" if Irmin or Duo was chosencontext_dir "/tmp/" returns "/tmp/brassaia_context" if Brassaia was chosenThis function should always be used when doing operations on the context directory.
do_not_use__brassaia_dir root will return "<root>/brassaia_context"
This function should not be used in "normal" code as it is used when importing to copy the imported "context" to "brassaia_context" in duo mode
val init :
kind:[ `Disk | `Memory ] ->
?patch_context:
(t -> (t, Tezos_base.TzPervasives.tztrace) Stdlib.result Lwt.t) ->
?readonly:bool ->
?index_log_size:int ->
data_dir:string ->
unit ->
index Tezos_base.TzPervasives.tzresult Lwt.tinit uses an environment variable ('TEZOS_CONTEXT_BACKEND') to select the `Disk backend between `Shell and `Brassaia. data_dir stands for the root directory in which the context directory is expected to be find.
val mem : t -> Tezos_context.Context.key -> bool Lwt.tmem t k is an Lwt promise that resolves to true iff k is bound to a value in t.
val mem_tree : t -> Tezos_context.Context.key -> bool Lwt.tmem_tree t k is like mem but for trees.
val find :
t ->
Tezos_context.Context.key ->
Tezos_context.Context.value option Lwt.tfind t k is an Lwt promise that resolves to Some v if k is bound to the value v in t and None otherwise.
val add :
t ->
Tezos_context.Context.key ->
Tezos_context.Context.value ->
t Lwt.tadd t k v is an Lwt promise that resolves to c such that:
k is bound to v in c;c is similar to t otherwise.If k was already bound in t to a value that is physically equal to v, the result of the function is a promise that resolves to t. Otherwise, the previous binding of k in t disappears.
val fold_value :
?depth:[ `Eq of int | `Le of int | `Lt of int | `Ge of int | `Gt of int ] ->
t ->
Tezos_context.Context.key ->
order:[ `Sorted | `Undefined ] ->
init:'a ->
f:
(Tezos_context.Context.key ->
(unit -> Tezos_context.Context.value option Lwt.t) ->
'a ->
'a Lwt.t) ->
'a Lwt.tfold ?depth t root ~order ~init ~f recursively folds over the trees and values of t. The f callbacks are called with a key relative to root. f is never called with an empty key for values; i.e., folding over a value is a no-op.
The depth is 0-indexed. If depth is set (by default it is not), then f is only called when the conditions described by the parameter is true:
Eq d folds over nodes and values of depth exactly d.Lt d folds over nodes and values of depth strictly less than d.Le d folds over nodes and values of depth less than or equal to d.Gt d folds over nodes and values of depth strictly more than d.Ge d folds over nodes and values of depth more than or equal to d.If order is `Sorted (the default), the elements are traversed in lexicographic order of their keys. For large nodes, it is memory-consuming, use `Undefined for a more memory efficient fold.
val add_protocol : t -> Tezos_base.TzPervasives.Protocol_hash.t -> t Lwt.tval get_protocol : t -> Tezos_base.TzPervasives.Protocol_hash.t Lwt.tval add_predecessor_block_metadata_hash :
t ->
Tezos_base.TzPervasives.Block_metadata_hash.t ->
t Lwt.tval add_predecessor_ops_metadata_hash :
t ->
Tezos_base.TzPervasives.Operation_metadata_list_list_hash.t ->
t Lwt.tval hash :
time:Tezos_base.TzPervasives.Time.Protocol.t ->
?message:string ->
t ->
Tezos_base.TzPervasives.Context_hash.tval get_test_chain : t -> Tezos_base.TzPervasives.Test_chain_status.t Lwt.tval add_test_chain :
t ->
Tezos_base.TzPervasives.Test_chain_status.t ->
t Lwt.tval fork_test_chain :
t ->
protocol:Tezos_base.TzPervasives.Protocol_hash.t ->
expiration:Tezos_base.TzPervasives.Time.Protocol.t ->
t Lwt.tval commit :
time:Tezos_base.TzPervasives.Time.Protocol.t ->
?message:string ->
t ->
Tezos_base.TzPervasives.Context_hash.t Lwt.tval gc : index -> Tezos_base.TzPervasives.Context_hash.t -> unit Lwt.tgc index commit_hash removes from disk all the data older than the commit_hash. Operations needing to checkout commits greater or equal to commit_hash will continue to work. Calling checkout h' on GC-ed commits will return None.
From the irmin point of view, a successful gc call on a commit_hash will result in a new prefix file containing that commit_hash as a root commit. This prefix file is considered as standalone as all the data referenced by that commit is contained in that file.
val wait_gc_completion : index -> unit Lwt.twait_gc_completion index will return a blocking thread if an Irmin GC is currently ongoing.
Warning: this currently only applies to GC started in the Irmin instance referenced as index; other opened instances will always return instantly.
val is_gc_allowed : index -> boolis_gc_allowed index returns whether or not it is possible to run a GC on the given context tree. If false is returned, it means that the context was run, at least once, with the indexing strategy mode "always", which is not suitable for GC.
val split : index -> unit Lwt.tsplit index creates a new suffix file, also called "chunk", into the irmin's file hierarchy.
To be optimal, the split function is expected to be called directly after committing, to the context, a commit (of hash context_hash) that will be a future candidate of a GC target. Thus, the commit commit_hash is the last commit stored on a given chunk. The GC called on that commit_hash will be able to extract that commit_hash into a new prefix file, and then, drop the whole chunk.
If the last commit of a chunk appears not to be the candidate of a future GC, it may result in keeping chunks containing partially needed data. This is not an issue, but it should be avoided to prevent storing unnecessary data and thus, to minimize the disk footprint.
val sync : index -> unit Lwt.tSync the context with disk. Only useful for read-only instances. Does not fail when the context is not in read-only mode.
val commit_test_chain_genesis :
t ->
Tezos_base.TzPervasives.Block_header.t ->
Tezos_base.TzPervasives.Block_header.t Lwt.tval compute_testchain_genesis :
t ->
Tezos_base.TzPervasives.Block_hash.t ->
Tezos_base.TzPervasives.Block_hash.tval merkle_tree :
t ->
Tezos_context_sigs__Context.Proof_types.merkle_leaf_kind ->
Tezos_context.Context.key ->
Tezos_context_sigs__Context.Proof_types.merkle_node
Tezos_base.TzPervasives.String.Map.t
Lwt.tval merkle_tree_v2 :
t ->
Tezos_context_sigs__Context.Proof_types.merkle_leaf_kind ->
Tezos_context.Context.key ->
Tezos_context.Context.Proof.tree Tezos_context.Context.Proof.t Lwt.tval commit_genesis :
index ->
chain_id:Tezos_base.TzPervasives.Chain_id.t ->
time:Tezos_base.TzPervasives.Time.Protocol.t ->
protocol:Tezos_base.TzPervasives.Protocol_hash.t ->
Tezos_base.TzPervasives.Context_hash.t Tezos_base.TzPervasives.tzresult Lwt.tval checkout :
index ->
Tezos_base.TzPervasives.Context_hash.t ->
t option Lwt.tval checkout_exn : index -> Tezos_base.TzPervasives.Context_hash.t -> t Lwt.tval exists : index -> Tezos_base.TzPervasives.Context_hash.t -> bool Lwt.tval close : index -> unit Lwt.tval compute_testchain_chain_id :
t ->
Tezos_base.TzPervasives.Block_hash.t ->
Tezos_base.TzPervasives.Chain_id.tval export_snapshot :
index ->
Tezos_base.TzPervasives.Context_hash.t ->
path:string ->
unit Lwt.tval integrity_check :
?ppf:Stdlib.Format.formatter ->
root:string ->
auto_repair:bool ->
always:bool ->
heads:string list option ->
index ->
unit Lwt.tval is_tezedge : t -> boolmodule Upgrade : sig ... end