Module Pvm.Context

This module defines the signature of an abstract PVM durable storage backend * type which can be parameterised with a concrete implementation `S`

type ('repo, 'tree) impl = (module S with type repo = 'repo and type tree = 'tree)
type tree = private
  1. | Tree : {
    1. tree : 'tree;
    2. impl : ('repo, 'tree) impl;
    } -> tree

The type of trees stored in the context, i.e. the actual data.

type 'a index = private
  1. | Index : {
    1. index : ('a, 'repo) Tezos_layer2_store.Context_sigs.index;
    2. impl : ('repo, 'tree) impl;
    } -> 'a index

The type of indexed repository for contexts. The parameter indicates if the index can be written or only read.

type rw_index = [ `Read | `Write ] index

Read/write index.

type ro_index = [ `Read ] index

Read only index.

type 'a t = private
  1. | Context : {
    1. index : ('a, 'repo) Tezos_layer2_store.Context_sigs.index;
    2. tree : 'tree;
    3. impl : ('repo, 'tree) impl;
    } -> 'a t

The type of context with its content.

type rw = [ `Read | `Write ] t

Read/write context t.

A context hash is the hash produced when the data of the context is committed to disk, i.e. the commit hash.

val load : ('repo, 'tree) impl -> cache_size:int -> ?async_domain:bool -> ([< `Read | `Write Read ] as 'a) Tezos_layer2_store.Access_mode.t -> string -> 'a index Tezos_base.TzPervasives.tzresult Lwt.t

load cache_size path initializes from disk a context from path. cache_size allows to change the LRU cache size of Irmin (100_000 by default at irmin-pack/config.ml

val reload : ro_index -> unit
val commit : ?message:string -> [> `Write ] t -> hash Lwt.t

commit ?message context commits content of the context context on disk, and return the commit hash.

val checkout_exn : 'a index -> hash -> 'a t Lwt.t
val empty : 'a index -> 'a t

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

val split : _ index -> unit

split ctxt creates a new suffix file, also called "chunk", into the Irmin'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 : [> `Write ] index -> ?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 : [> `Write ] index -> unit Lwt.t

wait_gc_completion index will return a blocking thread if a GC run is currently ongoing.