package cactus

  1. Overview
  2. Docs

Module Btree.MakeSource

Parameters

module InKey : Input.Key
module Size : Input.Size

Signature

Sourcetype key = InKey.t
Sourcetype value = InValue.t
Sourcetype t
Sourcetype cache
Sourceval empty_cache : unit -> cache

empty_cache () returns a fresh, empty cache.

Sourceval create : ?cache:cache -> ?record:string -> string -> t

create ?cache ?record root creates a btree storage in directory root. If no cache is specified each call to create opens a fresh instance. If record is specified then a trace is recorded in file record.

Sourceval replay : string -> ?prog:[ `None | `Single | `Multiple ] -> t -> unit

replay ?prog path t replays the operations stored in file path.

Sourceval init : root:string -> int -> read:(int -> string) -> t

init ~root n ~read performs a batch initialisation. read is an iterator-like function : read n reads the next n bindings and returns them in a single string chunk which is the concatenation of each key ^ value. init is (much) faster than adding each bindings one by one. It assumes that the bindings are sorted.

Sourceval reconstruct : string -> t

reconstruct root is like create root but assumes that the b.tree file in directory root is corrupted (nodes are possibly corrupted but the leaves are not impacted) and repairs it first.

Sourceval add : t -> key -> value -> unit
Sourceval remove : t -> key -> unit
Sourceval find : t -> key -> value
Sourceval mem : t -> key -> bool
Sourceval clear : t -> unit
Sourceval close : t -> unit
Sourceval flush : t -> unit
Sourceval iter : (key -> value -> unit) -> t -> unit
Sourceval iteri : (int -> key -> value -> unit) -> t -> unit
Sourceval length : t -> int

length t is the number of bindings in t

Sourceval pp : t Fmt.t
Sourceval snapshot : ?depth:int -> t -> unit

For every node/leaf in t which are at least depth away from the leaves, snapshot ~depth t, write in a file its rep as given by their corresponding pp function.

Sourcemodule Private : sig ... end