package index

  1. Overview
  2. Docs
A platform-agnostic multi-level index for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

index-1.0.0.tbz
sha256=9e2b60bffcad828b2c732cbdfb6c35627443062fb482d08e431035f78e54584a
sha512=44d710f5ef3007abfbbab4bcc8d408e59d55f109fff81c7be6513fb838092039b6af4371f6df14d1746eaa0b9784549ebfecd9cf8b0578fa831281162ba635e3

doc/index.unix/Index_unix/Make/index.html

Module Index_unix.Make

Parameters

module K : Index.Key
module V : Index.Value

Signature

type t

The type for indexes.

type key = K.t

The type for keys.

type value = V.t

The type for values.

val v : ?fresh:bool -> ?readonly:bool -> log_size:int -> string -> t

The constructor for indexes.

  • parameter fresh

    whether an existing index should be overwritten.

  • parameter read_only

    whether read-only mode is enabled for this index.

  • parameter log_size

    the maximum number of bindings in the `log` IO.

val clear : t -> unit

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

val find : t -> key -> value

find t k is the binding of k in t.

val mem : t -> key -> bool

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

exception Invalid_key_size of key
exception Invalid_value_size of value

The exceptions raised when trying to add a key or a value of different size than encoded_size

val replace : t -> key -> value -> unit

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

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

Iterates over the index bindings. Order is not specified. In case of recent replacements of existing values (after the last merge), this will hit both the new and old bindings.

val force_merge : ?hook:[ `After | `Before ] Index.Private.Hook.t -> t -> unit

force_merge t forces a merge for t.

val flush : t -> unit

Flushes all buffers to the supplied IO instance.

val close : t -> unit

Closes all resources used by t.

OCaml

Innovation. Community. Security.