diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-23 03:40:37 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-23 03:40:37 -0300 |
| commit | 41c6334bf21b1cbae228b1d75bf3d095ba84bcca (patch) | |
| tree | 34b939e70fe7cc44f4ae3434fc808cd59f2225d5 /lib | |
| parent | 28c55a730d9a0a19a62d85c166dc879aebd7b772 (diff) | |
| download | RNT-41c6334bf21b1cbae228b1d75bf3d095ba84bcca.tar.gz RNT-41c6334bf21b1cbae228b1d75bf3d095ba84bcca.zip | |
allow to close storage
Diffstat (limited to '')
| -rw-r--r-- | lib/abstract/Storage.ml | 3 | ||||
| -rw-r--r-- | lib/backend/storage/LMDB.ml | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/abstract/Storage.ml b/lib/abstract/Storage.ml index 888a354..afd1a3c 100644 --- a/lib/abstract/Storage.ml +++ b/lib/abstract/Storage.ml @@ -6,6 +6,9 @@ module type STORAGE = sig val connect : Concepts.Configuration.term -> (connection, Concepts.Condition.condition) result + (** close `connection`, after which none of its transactions may be used *) + val disconnect : connection -> unit + (** begin a transaction within `connection` *) val start : connection -> (transaction, Concepts.Condition.condition) result diff --git a/lib/backend/storage/LMDB.ml b/lib/backend/storage/LMDB.ml index 92de30e..e364b6a 100644 --- a/lib/backend/storage/LMDB.ml +++ b/lib/backend/storage/LMDB.ml @@ -167,6 +167,8 @@ let connect (c : Concepts.Configuration.term) = Concepts.Condition.( complement ("path" |=| Concepts.Value.String path & "mode" |=| Concepts.Value.Integer mode) ) +let disconnect ({env; _} : connection) = C.mdb_env_close env + let begin_with flags ({env; dbi} : connection) = C.mdb_txn_begin' env C.null_txn flags |> Result.map (fun tx -> {tx; dbi; active = true;}) |
