package octez-l2-libs

  1. Overview
  2. Docs

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
  1. | Context : {
    1. index : ('a, 'repo) Context_sigs.index;
    2. pvm_context_impl : ('repo, 'tree) pvm_context_impl;
    3. impl_name : string;
    4. tree : 'tree;
    5. equality_witness : ('repo, 'tree) Context_sigs.equality_witness;
    } -> 'a t

See Tezos_protocol_environment.Environement_context.t

type rw = [ `Read | `Write ] t

Read/write context t.

type ro = [ `Read ] t

Read-only 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 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)

val index : 'a t -> 'a t

index context is the repository of the context context.

val close : 'a t -> unit Lwt.t

close ctxt closes the context index ctxt.

val readonly : [> `Read ] t -> [ `Read ] t

readonly index returns a read-only version of the index.

val checkout : 'a t -> hash -> 'a t option Lwt.t

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.

val empty : 'a t -> 'a t

empty ctxt is the context with an empty content for the repository ctxt.

val commit : ?message:string -> [ `Read | `Write ] t -> hash Lwt.t

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.

val gc : [ `Read | `Write ] t -> ?callback:(unit -> unit Lwt.t) -> hash -> unit Lwt.t

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 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 =
  1. | PVMState : {
    1. pvm_context_impl : ('repo, 'tree) pvm_context_impl;
    2. impl_name : string;
    3. pvmstate : 'tree;
    4. 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
OCaml

Innovation. Community. Security.