123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2021 Nomadic Labs, <contact@nomadic-labs.com> *)(* Copyright (c) 2023 Marigold <contact@marigold.dev> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)openStore_sigsmoduleEquality_witness:sigtype(_,_)eq=Refl:('a,'a)eqtype'atvalmake:unit->'atvaleq:'at->'bt->('a,'b)eqoptionend=structtype(_,_)eq=Refl:('a,'a)eqtype_equality=..moduletypeInst=sigtypettype_equality+=Eq:tequalityendtype'at=(moduleInstwithtypet='a)letmake:typea.unit->at=fun()->letmoduleInst=structtypet=atype_equality+=Eq:tequalityendin(moduleInst)leteq:typeab.at->bt->(a,b)eqoption=fun(moduleA)(moduleB)->matchA.EqwithB.Eq->SomeRefl|_->Noneendtype('a,'b)equality_witness='aEquality_witness.t*'bEquality_witness.ttype('a,'repo)raw_index={path:string;repo:'repo}type('a,'repo)index=('a,'repo)raw_indexconstraint'a=[<`Read|`Write>`Read]type('a,'repo,'tree)t={index:('a,'repo)index;tree:'tree;}constraint'a=[<`Read|`Write>`Read]moduletypeS=sigtypetreetyperepotypenonrec'aindex=('a,repo)indexvalimpl_name:stringvalequality_witness:(repo,tree)equality_witnesstypenonrec'at=('a,repo,tree)ttypehash=Context_hash.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) *)valload:cache_size:int->'amode->string->'aindextzresultLwt.t(** [index context] is the repository of the context [context]. *)valindex:'at->'aindex(** [close ctxt] closes the context index [ctxt]. *)valclose:_index->unitLwt.t(** [readonly index] returns a read-only version of the index. *)valreadonly:[>`Read]index->[`Read]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]. *)valcheckout:'aindex->hash->'atoptionLwt.t(** [empty ctxt] is the context with an empty content for the repository [ctxt]. *)valempty:'aindex->'at(** [commit ?message context] commits content of the context [context] on disk,
and return the commit hash. *)valcommit:?message:string->[>`Write]t->hashLwt.t(** [is_gc_finished index] returns true if a GC is finished (or idle) and false
if a GC is running for [index]. *)valis_gc_finished:[>`Write]index->bool(** [split ctxt] splits the current context in order to chunk the file if the
backend supports it. This split function is expected to be called after
committing a commit that will be a future candidate for a GC target. *)valsplit:_index->unit(** [gc index ?callback hash] removes all data older than [hash] from disk.
If passed, [callback] will be executed when garbage collection finishes. *)valgc:[>`Write]index->?callback:(unit->unitLwt.t)->hash->unitLwt.t(** [wait_gc_completion index] will return a blocking thread if a
GC run is currently ongoing. *)valwait_gc_completion:[>`Write]index->unitLwt.t(** [export_snapshot index context_hash ~path] exports the context
corresponding to [context_hash], if found in [index], into the given
folder path. *)valexport_snapshot:_index->hash->path:string->unittzresultLwt.t(** State of the PVM that this rollup node deals with *)modulePVMState:sig(** The value of a PVM state *)typevalue=tree(** [empty ()] is the empty PVM state. *)valempty:unit->value(** [find context] returns the PVM state stored in the [context], if any. *)valfind:_t->valueoptionLwt.t(** [lookup state path] returns the data stored for the path [path] in the PVM
state [state]. *)vallookup:value->stringlist->bytesoptionLwt.t(** [set context state] saves the PVM state [state] in the context and returns
the updated context. Note: [set] does not perform any write on disk, this
information must be committed using {!val:commit}. *)valset:'at->value->'atLwt.tendmoduleInternal_for_tests:sig(** [get_a_tree key] provides a value of internal type [tree] which can be
used as a state to be set in the context directly. *)valget_a_tree:string->treeLwt.tendend