module Pkv_api:Plasma Key Value APIsig..end
There are also limitations:
Plasma_client.Plasma_error `econflict when another writer is
currently active.type db
type openflag = [ `Create of int | `Transactional ]
val opendb : Plasma_client.plasma_cluster -> string -> openflag list -> db opendb c basename flags: Opens the database using the client c.
basename must be an absolute PlasmaFS path without suffix. The
actual files have names:
basename.data: This file contains the key/value pairs in sequential
orderbasename.del: This file points to key/value pairs that are considered
as deleted, but that have not yet been physically eliminated.basename.idx: This is the index making lookups by key possible.`Create n: Create the db if the files are missing. The number
n is the maximum key length.`Transactional: Open the db in transactional mode. Only in this
mode ACID properties are guaranteed. Opening takes longer because
more metadata needs to be retrieved from the PlasmaFS server.type openflag_e = [ `Transactional ]
val opendb_e : Plasma_client.plasma_cluster ->
string -> openflag_e list -> db Uq_engines.engineval max_key_size : db -> intval insert : db -> string -> string -> unitinsert db key value: Inserts a new entry, or replaces an
existing entry with the same key.val insert_large : db -> string -> int64 -> Netchannels.in_obj_channel -> unitinsert_large db key size ch: Inserts a new entry, or replaces an
existing entry with the same key. The size of the value must be
known and be passed as size. The value is obtained by reading
from ch.val insert_channel : db -> string -> int64 -> Netchannels.out_obj_channelinsert_channel db key size: Returns a channel into which the
inserted value must be written. The channel must be closed.
The value must have exactly the given size.
It is invalid to do any other modification to the db while the
returned channel is open.
val delete : db -> string -> unitdelete db key: Deletes this key, if it existsval lookup : db -> string -> stringlookup db key: Looks this key up, and returns it.
Raises Not_found if not found.val lookup_large : db ->
string -> string -> (int64 -> Netchannels.out_obj_channel) -> unitlookup_large db key buf f: If the key is found, the function f
is called with the size of the value. f must return an object
channel into which the value is written.
buf is a string that is used as temporary buffer. It should
not be too small, e.g. 64K. buf can be reused in the next
lookup_large call.
If the key is not found, the function will raise Not_found
val lookup_large_e : db ->
string -> string -> (int64 -> Uq_io.out_device) -> unit Uq_engines.engineval iterate : db -> (string -> unit) -> unititerate db f: Calls the function f with all keys, in index
order.val vacuum : db -> unit
vacuum can run in parallel to other read accesses. Other writes
are locked out.
vacuum implies a commit of the db, which is closed (see below).
val newer_version_available : db -> bool
In non-transactional mode, this function returns only true
if a vaccum run makes it necessary to re-open the database.
This function can raise Plasma_client.Plasma_error exceptions,
especially when the database files are deleted or inaccessible.
val newer_version_available_e : db -> bool Uq_engines.engineval commit : db -> unitval abort : db -> unitval abort_e : db -> unit Uq_engines.engineval reopen : db -> unitcommit or abortval reopen_e : db -> unit Uq_engines.engine