Page
Library
Module
Module type
Parameter
Class
Class type
Source
Lmdb.MapSourceKey-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 ([ `Uni ]) 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) tcreate 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) topen_existing env is like create, but only opens already existing maps.
close map closes and invalidates the map handle. Normalle unnecessary. Use with care. See the lmdb manual.
get map key returns the first value associated to key.
val add :
('key, 'value, _) t ->
?txn:[> `Write ] Txn.t ->
?flags:Flags.t ->
'key ->
'value ->
unitadd map key value adds value to key.
Existing values are neither removed nor overwritten.
val set :
('key, 'value, _) t ->
?txn:[> `Write ] Txn.t ->
?flags:Flags.t ->
'key ->
'value ->
unitset 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.
Dispensers / Generators are iterators meant to be used via Stdlib.Seq.of_dispenser or the Gen module
They create a read-only (child) transaction and cursor which are automatically closed when the Dispenser is exhausted. Therefore be sure to completely exhaust a dispenser in a timely fashion.
val to_dispenser :
?txn:[> `Read ] Txn.t ->
('key, 'value, _) t ->
unit ->
('key * 'value) optionto_dispenser map returns key-value pairs in order.
val to_dispenser_rev :
?txn:[> `Read ] Txn.t ->
('key, 'value, _) t ->
unit ->
('key * 'value) optionto_dispenser_rev map returns key-value pairs in reverse order.
val to_dispenser_all :
?txn:[> `Read ] Txn.t ->
('key, 'value, [> `Dup ]) t ->
unit ->
('key * 'value array) optionto_dispenser_all map returns keys with their associated values in order.
val to_dispenser_rev_all :
?txn:[> `Read ] Txn.t ->
('key, 'value, [> `Dup ]) t ->
unit ->
('key * 'value array) optionto_dispenser_all map returns keys with their associated values in reverse order.
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.