package octez-l2-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/octez-l2-libs.layer2_store/Tezos_layer2_store/Context/index.html
Module Tezos_layer2_store.Context
Source
This module dipatches context calls to contexts/pvm_states corresponding to the used pvm
This module is largely inspired from Tezos_protocol_environment.Environement_context
type ('repo, 'tree) pvm_context_impl =
(module Context_sigs.S
with type repo = 'repo
and type tree = 'tree)
See Tezos_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 Tezos_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
val load :
('repo, 'tree) pvm_context_impl ->
cache_size:int ->
[< `Read | `Write Read ] as 'a Store_sigs.mode ->
string ->
'a t Tezos_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)
readonly index
returns a read-only version of the index.
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
.
empty ctxt
is the context with an empty content for the repository ctxt
.
commit ?message context
commits content of the context context
on disk, and return the commit hash.
is_gc_finished index
returns true if a GC is finished (or idle) and false if a GC is running for index
.
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.
wait_gc_completion index
will return a blocking thread if a GC run is currently ongoing.
val export_snapshot :
_ t ->
hash ->
path:string ->
unit Tezos_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