Legend:
Library
Module
Module type
Parameter
Class
Class type
Managing store's trees.
Tree provides immutable, in-memory partial mirror of the store, with lazy reads and delayed writes.
Trees are like staging area in Git: they are immutable temporary non-persistent areas (they disappear if the host crash), held in memory for efficiency, where reads are done lazily and writes are done only when needed on commit: if you modify a key twice, only the last change will be written to the store when you commit.
empty () is the empty tree. The empty tree does not have associated backend configuration values, as they can perform in-memory operation, independently of any given backend.
pruned h is a purely in-memory tree with the hash h. Such trees can be used as children of other in-memory tree nodes, for instance in order to compute the hash of the parent, but they cannot be dereferenced.
Any operation that would require loading the contents of a pruned node (e.g. calling find on one of its children) will instead raise a Pruned_hash exception. Attempting to export a tree containing pruned sub-trees to a repository will fail similarly.
val kind : tree->key->[ `Contents | `Node ] optionLwt.t
kind t k is the type of s in t. It could either be a tree node or some file contents. It is None if k is not present in t.
The type for fold's force parameter. `True forces the fold to read the objects of the lazy nodes and contents. `False f is applying f on every lazy node and content value instead.
The type for fold's uniq parameters. `False folds over all the nodes. `True does not recurse on nodes already seen. `Marks m uses the collection of marks m to store the cache of keys: the fold will modify m. This can be used for incremental folds.
val fold :
?order:[ `Sorted | `Undefined| `Random of Stdlib.Random.State.t ]->?force:'aforce->?cache:bool ->?uniq:uniq->?pre:'anode_fn->?post:'anode_fn->?depth:depth->?contents:(key->contents->'a->'aLwt.t)->?node:(key->node->'a->'aLwt.t)->?tree:(key->tree->'a->'aLwt.t)->tree->'a->'aLwt.t
fold f t acc folds f over t's leafs.
For every node n, ui n is a leaf node, call f path n. Otherwise:
Call pre path n. By default pre is the identity;
Recursively call fold on each children.
Call post path n; By default post is the identity.
See force for details about the force parameters. By default it is `True.
See uniq for details about the uniq parameters. By default it is `False.
The fold depth is controlled by the depth parameter.
cache defaults to false, see caching for an explanation of the parameter.
If order is `Sorted (the default), the elements are traversed in lexicographic order of their keys. If `Random state, they are traversed in a random order. For large nodes, these two modes are memory-consuming, use `Undefined for a more memory efficient fold.
Hashes in the Irmin store are tagged with the type of the value they reference (either contents or node). In the contents case, the hash is paired with corresponding metadata.
produce r h f runs f on top of a real store r, producing a proof and a reulst using the initial root hash h.
The trees produced during f's computation will carry the full history of reads. This history will be reset when f is complete so subtrees escaping the scope of f will not cause memory leaks.
It is possible to call produce_proof recursively. In that case, each input trees will have their own history of reads and will contain only the reads needed to unshallow that corresponding trees. Proof trees proof should then interact as if they were all unshallowed (note: in the case of nested proofs, it's unclear what verify_proof should do...).
verify t f runs f in checking mode, loading data from the proof as needed.
When the result is Ok (t, r), t is the generated tree after f has completed and r is the result of the computation. More operations can be run on t, but it won't be able to access the underlying storage and will raise Dangling_hash when trying to read unloaded parts of t.
When the result is Error msg, the proof is rejected.
Guarantee that the given computation performs exactly the same state operations as the generating computation, in the exact same order.*in some order*.