Library
Module
Module type
Parameter
Class
Class type
Key-value maps.
type ('key, 'value, -'dup) t constraint 'perm = [< `Read | `Write ] constraint 'dup = [< `Dup | `Uni ]
A handle for a map from keys of type 'key
to values of type 'value
. The map may support only a single value per key ([ `Dup ]
) or multiple values per key ([ `Dup | `Uni ]
).
val create :
[< `Dup | `Uni ] as 'dup card ->
key:'key Conv.t ->
value:'value Conv.t ->
?txn:[> `Read | `Write ] Txn.t ->
?name:string ->
Env.t ->
('key, 'value, 'dup) t
create dup ~key ~value env
open (and possibly create) a map in the environment env
.
dup
may be Dup
or Nodup
, specifying whether the map supports multiple values per key.
Only a single transaction may call this function at a time. This transaction needs to finish before any other transaction may call this function.
val open_existing :
[< `Dup | `Uni ] as 'dup card ->
key:'key Conv.t ->
value:'value Conv.t ->
?txn:[> `Read ] Txn.t ->
?name:string ->
Env.t ->
('key, 'value, 'dup) t
open_existing env
is like create
, but only opens already existing maps.
get map key
returns the first value associated to key
.
module Flags : sig ... end
add map key value
adds value
to key
.
For a map not supporting duplicates an existing value is overwritten. For a map supporting duplicates the value is added to the key. This is the same as overwrite
for duplicate maps, but overwrite ~flags:Flags.no_overwrite
for non-duplicate maps.
set map key value
sets binding of key
to value
.
Values of an already existing key are silently overwritten.
remove map key
removes key
from map
.
drop ?delete map
Empties map
.
compare_key map ?txn a b
Compares a
and b
as if they were keys in map
.
compare map ?txn a b
Same as compare_key
.