diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-23 03:23:40 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-23 03:23:40 -0300 |
| commit | b4422c99e10a8daee452b22aea84cb1f68ae54bc (patch) | |
| tree | 1f2ac50f4c536b8da83fca654cb3a6dee86a9975 /lib/kernel/Storage.ml | |
| parent | f88aeff9f7a673e945484a31fbcaed647bb3d2fa (diff) | |
| download | RNT-b4422c99e10a8daee452b22aea84cb1f68ae54bc.tar.gz RNT-b4422c99e10a8daee452b22aea84cb1f68ae54bc.zip | |
refactor ephemeral and subs relations
Diffstat (limited to '')
| -rw-r--r-- | lib/kernel/Storage.ml | 7 | ||||
| -rw-r--r-- | lib/kernel/Storage.mli | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/kernel/Storage.ml b/lib/kernel/Storage.ml index dd06783..f0c4800 100644 --- a/lib/kernel/Storage.ml +++ b/lib/kernel/Storage.ml @@ -36,11 +36,14 @@ module Make (S : Abstract.Storage.STORAGE) = struct let _ = S.abort tx in Error condition - let with_transaction connection body = + let within start connection body = let open Utilities.Result in - let* tx = S.start connection in + let* tx = start connection in body tx |> finish tx + let with_transaction connection = within S.start connection + let with_read connection = within S.start_read connection + let store_blob tx blob = let open Utilities.Result in let address = Concepts.Hash.hash_of_blob blob in diff --git a/lib/kernel/Storage.mli b/lib/kernel/Storage.mli index b8c0e5b..fa8a785 100644 --- a/lib/kernel/Storage.mli +++ b/lib/kernel/Storage.mli @@ -12,6 +12,7 @@ module Make : functor (S : Abstract.Storage.STORAGE) -> sig val finish : S.transaction -> ('a, Concepts.Condition.condition) result -> ('a, Concepts.Condition.condition) result val with_transaction : S.connection -> (S.transaction -> ('a, Concepts.Condition.condition) result) -> ('a, Concepts.Condition.condition) result + val with_read : S.connection -> (S.transaction -> ('a, Concepts.Condition.condition) result) -> ('a, Concepts.Condition.condition) result val store_blob : S.transaction -> Concepts.Blob.t -> (Concepts.Hash.hash, Concepts.Condition.condition) result val get_req: S.transaction -> S.address -> (Concepts.Blob.t, Concepts.Condition.condition) result end |
