Mavryk_layer2_store.Context
This module dipatches context calls to contexts/pvm_states corresponding to the used pvm
This module is largely inspired from Mavryk_protocol_environment
.Environement_context
type ('repo, 'tree) pvm_context_impl =
(module Context_sigs.S
with type repo = 'repo
and type tree = 'tree)
See Mavryk_protocol_environment
.Environement_context.ops
type 'a t = private
| Context : {
index : ('a, 'repo) Context_sigs.index;
pvm_context_impl : ('repo, 'tree) pvm_context_impl;
impl_name : string;
tree : 'tree;
equality_witness : ('repo, 'tree) Context_sigs.equality_witness;
} -> 'a t
See Mavryk_protocol_environment
.Environement_context.t
val make :
index:('a, 'b) Context_sigs.index ->
tree:'c ->
pvm_context_impl:('b, 'c) pvm_context_impl ->
equality_witness:('b, 'c) Context_sigs.equality_witness ->
impl_name:string ->
'a t
val equiv :
('a Context_sigs.Equality_witness.t * 'b Context_sigs.Equality_witness.t) ->
('c Context_sigs.Equality_witness.t * 'd Context_sigs.Equality_witness.t) ->
('a, 'c) Context_sigs.Equality_witness.eq option
* ('b, 'd) Context_sigs.Equality_witness.eq option
type hash = Mavryk_base.TzPervasives.Context_hash.t
val load :
('repo, 'tree) pvm_context_impl ->
cache_size:int ->
[< `Read | `Write Read ] as 'a Store_sigs.mode ->
string ->
'a t Mavryk_base.TzPervasives.tzresult Lwt.t
load cache_size path
initializes from disk a context from path
. cache_size
allows to change size of the Context Backend in use (for instance, the LRU cache size of Irmin (100_000 by default at irmin-pack/config.ml)
val close : 'a t -> unit Lwt.t
close ctxt
closes the context index ctxt
.
checkout ctxt hash
checkouts the content that corresponds to the commit hash hash
in the repository ctxt
and returns the corresponding context. If there is no commit that corresponds to hash
, it returns None
.
commit ?message context
commits content of the context context
on disk, and return the commit hash.
val is_gc_finished : [ `Read | `Write ] t -> bool
is_gc_finished index
returns true if a GC is finished (or idle) and false if a GC is running for index
.
val split : _ t -> unit
split ctxt
creates a new suffix file, also called "chunk", into the context's file hierarchy. This split function is expected to be called after committing a commit that will be a future candidate for a GC target.
gc index ?callback hash
removes all data older than hash
from disk. If passed, callback
will be executed when garbage collection finishes.
val wait_gc_completion : [ `Read | `Write ] t -> unit Lwt.t
wait_gc_completion index
will return a blocking thread if a GC run is currently ongoing.
val export_snapshot :
_ t ->
hash ->
path:string ->
unit Mavryk_base.TzPervasives.tzresult Lwt.t
export_snapshot index context_hash ~path
exports the context corresponding to context_hash
, if found in index
, into the given folder path.
type pvmstate =
| PVMState : {
pvm_context_impl : ('repo, 'tree) pvm_context_impl;
impl_name : string;
pvmstate : 'tree;
equality_witness : ('repo, 'tree) Context_sigs.equality_witness;
} -> pvmstate
val make_pvmstate :
pvm_context_impl:('a, 'b) pvm_context_impl ->
equality_witness:('a, 'b) Context_sigs.equality_witness ->
impl_name:string ->
pvmstate:'b ->
pvmstate
module PVMState : sig ... end
State of the PVM that this rollup node deals with
module Version : sig ... end
module Internal_for_tests : sig ... end