Constructors
val empty : treeempty 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.
of_contents c is the subtree built from the contents c.
General-purpose constructor for trees.
General-purpose destructor for trees.
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.
list t key is the list of files and sub-nodes stored under k in t.
Diffs
diff x y is the difference of contents between x and y.
Manipulating Contents
find_all t k is Some (b, m) if k is associated to the contents b and metadata m in t and None if k is not present in t.
find is similar to find_all but it discards metadata.
Same as find_all but raise Invalid_arg if k is not present in t.
add t k c is the tree where the key k is bound to the contents c but is similar to t for other bindings.
remove t k is the tree where k bindings has been removed but is similar to t for other bindings.
Manipulating Subtrees
find_tree t k is Some v if k is associated to v in t. It is None if k is not present in t.
get_tree t k is v if k is associated to v in t. Raise Invalid_arg if k is not present in t.
add_tree t k v is the tree where the key k is bound to the tree v but is similar to t for other bindings
val merge : tree Irmin.Merge.tmerge is the 3-way merge function for trees.
Folds
val empty_marks : unit -> marksempty_marks () is an empty collection of marks.
The type for fold's force parameter. `True forces the fold to read the objects of the lazy nodes. `False f is applying f on every lazy node 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 : ?force:'a force -> ?uniq:uniq -> ?pre:'a node_fn -> ?post:'a node_fn -> (key -> contents -> 'a -> 'a Lwt.t) -> tree -> 'a -> 'a Lwt.tfold 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 defaultpreis the identity; - Recursively call
foldon each children, in lexicographic order; - Call
post path n; By defaultpostis 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.
Stats
type stats = {nodes : int; | Number of node. |
leafs : int; | Number of leafs. |
skips : int; | Number of lazy nodes. |
depth : int; | Maximal depth. |
width : int; | Maximal width. |
}The type for tree stats.
stats ~force t are t's statistics. If force is true, this will force the reading of lazy nodes. By default it is false.
Concrete Trees
The type for concrete trees.
val concrete_t : concrete Irmin.Type.tThe value-type for concrete.
to_concrete t is the concrete tree equivalent to the subtree t.
Caches
val clear : ?depth:int -> tree -> unitclear ?depth t clears all the cache in the tree t for subtrees with a depth higher than depth. If depth is not set, all the subtrees are cleared.
Performance counters
type counters = {}val counters : unit -> countersval dump_counters : unit Fmt.tval inspect : tree -> [ `Contents | `Node of [ `Map | `Hash | `Value ] ]Import/Export
of_hash r h is the the tree object in r having h as hash, or None is no such tree object exists.