package lmdb
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Module Lmdb.Txn
Source
Series of operations on an environment performed atomically.
A transaction handle. A transaction may be read-only or read-write.
go perm env f
runs a transaction with perm
read/write permissions in env
.
The function f txn
will receive the transaction handle. All changes to the environment env
done using the transaction handle will be persisted to the environment only when f
returns. After f
returned, the transaction handle is invalid and should therefore not be leaked outside f
.
Here is an example incrementing a value atomically:
go rw env begin fun txn ->
let v = Map.get ~txn k in
Map.add ~txn k (v+1) ;
v
end
abort txn
aborts transaction txn
and the current go
function, which will return None
.