Module type
Class type
include Index.S with type value = int64 * int * char
type t

The type for indexes.

type key

The type for keys.

type value = int64 * int * char

The type for values.

type cache

The type for caches of index instances.

val empty_cache : unit -> cache

Construct a new empty cache of index instances.

val clear : t -> unit

clear t clears t so that there are no more bindings in it.

val mem : t -> key -> bool

mem t k is true iff k is bound in t.

val replace : ?overcommit:bool -> t -> key -> value -> unit

replace t k v binds k to v in t, replacing any existing binding of k.

If overcommit is true, the operation does not triger a merge, even if the caches are full. By default overcommit is false.

val filter : t -> ((key * value) -> bool) -> unit

filter t p removes all the bindings (k, v) that do not satisfy p. This operation is costly and blocking.

val iter : (key -> value -> unit) -> t -> unit

Iterates over the index bindings. Limitations:

  • Order is not specified.
  • In case of recent replacements of existing values (since the last merge), this will hit both the new and old bindings.
  • May not observe recent concurrent updates to the index by other processes.
val flush : ?no_callback:unit -> ?with_fsync:bool -> t -> unit

Flushes all internal buffers of the IO instances.

  • Passing ~no_callback:() disables calling the flush_callback passed to v.
  • If with_fsync is true, this also flushes the OS caches for each IO instance.
val sync : t -> unit

sync t syncs a read-only index with the files on disk. Raises RW_not_allowed if called by a read-write index.

val is_merging : t -> bool

is_merging t returns true if t is running a merge. Raises RO_not_allowed if called by a read-only index.

val try_merge : t -> unit

try_merge is like merge but is a no-op if the number of entries in the write-ahead log is smaller than log_size.

module Checks : sig ... end

Offline fsck-like utility for checking the integrity of Index stores built using this module.

val v : ?flush_callback:(unit -> unit) -> ?fresh:bool -> ?readonly:bool -> ?throttle:[ `Block_writes | `Overcommit_memory ] -> log_size:int -> string -> t

Constructor for indices, memoized by (path, readonly) pairs.

val find : t -> key -> value option
val add : ?overcommit:bool -> t -> key -> value -> unit
val close : t -> unit
val merge : t -> unit
module Stats = Index.Stats