module type KV =sig
..end
KV
provides access to typed and named values.
type'a
codec =('a -> string) * (string -> ('a, Rresult.R.msg) Rresult.result)
exception Decode_error of string * Rresult.R.msg
Decode (key,
msg)
is raised it means that the store's data for key
could
not be decoded using the client's codec. This exception is not
meant to be handled by programs, it indicates a configuration
mismatch between the program and its environment.type 'a
key
'a
.val key : string -> 'a codec -> 'a key
key name codec
is a key with lookup name name
and whose value
is codec'd by codec
.val key_name : 'a key -> string
key_name k
is k
's name.val key_codec : 'a key -> 'a codec
key_codec k
is k
's codec.val mem : 'a key -> bool
mem k
is true
iff k
is bound to a value of type 'a
in the key-value store.val find : 'a key -> 'a option
find k
is k
's binding in the key-value store (if any).Decode_error
in case of value decode error.val get : ?absent:'a -> 'a key -> 'a
get k
is k
's binding the key-value store. If absent
is
specified this value is returned if k
is not bound in the store.Invalid_argument
if k
is unbound in the key-value store
and absent
is not specified. TODO maybe unify that with
Decode_error.Decode_error
in case of value decode error.val set : 'a key -> 'a option -> unit
set k v
sets the key value of k
to v
.type
watcher
val watch : 'a key -> ('a key -> 'a option -> unit) -> watcher
val unwatch : watcher -> unit
unwatch w
stops the watcher w
. After that call it's callback
is guaranteed not to be called again.