Module Bitcask


module Bitcask: sig .. end
local key value store
Author(s): Jonathan Derque

type t 
val tombstone_value : string
special value denoting a removed entry.
exception Operation_not_permitted
exception thrown when attempting to modify read only stores.

Basic operations


val create : ?mode:Unix.file_perm ->
?options:BitcaskOption.bitcask_option -> string -> t
create ~mode ~options directory creates a new bitcask store on disk.
Raises Unix_error(EEXIST, "mkdir", directory) when the directory already exist.
val load_with_options : BitcaskOption.bitcask_option -> string -> t
load_with_options options directory loads an existing bitcask store from disk. If options are not supplied, then BitcaskOption.default_options is used.
val load : ?mode:BitcaskOption.open_mode ->
?max_file_size:int64 ->
?create_if_needed:bool -> ?ignore_hint_files:bool -> string -> t
load directory loads an existing bitcask store from disk with the supplied options. Default options value are described in BitcaskOption.
val close : t -> unit
close a bitcask store.
val directory : t -> string
directory bitcask returns the location of a bitcask store.
val contains : t -> string -> bool
contains bitcask key checks whether a key is contained in a bitcask store.
val get : t -> string -> string option
get bitcask key retrieves the value associated with key in a bitcask store.
val get_exn : t -> string -> string
get bitcask key retrieves the value associated with key in a bitcask store.
Raises Not_found when a bitcask store does not contain the key
val put : t -> string -> string -> unit
put bitcask key value stores the value associated with key in a bitcask store. The previous value associated with key can no longer be retrieved.
Raises Operation_not_permitted when a bitcask was opened in read-only mode.
val remove : t -> string -> unit
remove bitcask key value removes the value associated with key in a bitcask store. The previous value associated with key can no longer be retrieved.
Raises Operation_not_permitted when a bitcask was opened in read-only mode.

Iterators


val fold_left : (int32 -> string -> string -> 'a -> 'a) -> 'a -> t -> 'a
fold_left f accu bitcask folds over all live key value pairs in a bitcask. f should be in the form f timestamp key value accu.
val iter : (int32 -> string -> string -> unit) -> t -> unit
iter f bitcask iterates over all live key value pairs in a bitcask. f should be in the form f timestamp key value.

Administration


val compact : t -> unit
compact bitcask gathers all live key value pairs contained in a bitcask store and writes them to new data files. You should not call compact directly but use merge instead.
Raises Operation_not_permitted when a bitcask was opened in read-only mode.
val sweep : t -> unit
sweep bitcask removes all data file that no longer contain live key value pairs in a bitcask store. You should not call sweep directly but use merge instead.
val merge : t -> unit
merge bitcask attempts to move live entries to new data files and reclaim space used by the old data files.
Raises Operation_not_permitted when a bitcask was opened in read-only mode.