aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/BranchManager.ml
diff options
context:
space:
mode:
authorEstevan Castilho <tevo@riajuu.net>2026-08-27 01:35:53 +0000
committerEstevan Castilho <tevo@riajuu.net>2026-08-27 01:41:12 +0000
commite61404f0219cd8f07c6c278f7ee952c70ce5bdf4 (patch)
tree412aa6ca71df835fb154427a32bb2573944faa8a /lib/kernel/BranchManager.ml
parent9efb32195a905de2d66ce29164cc22970833c2d7 (diff)
downloadRNT-e61404f0219cd8f07c6c278f7ee952c70ce5bdf4.tar.gz
RNT-e61404f0219cd8f07c6c278f7ee952c70ce5bdf4.zip
Branch serialization
Diffstat (limited to '')
-rw-r--r--lib/kernel/BranchManager.ml9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/kernel/BranchManager.ml b/lib/kernel/BranchManager.ml
index bdc461e..cd3c5e2 100644
--- a/lib/kernel/BranchManager.ml
+++ b/lib/kernel/BranchManager.ml
@@ -19,6 +19,7 @@ end
module Make (S : Abstract.Storage.STORAGE) = struct
module M = Merkle.Make (S) (Merkle.StringKey)
module SI = Storage.Make (S)
+ module B = Branch.Make (S)
let root_for tx label =
let open Utilities.Result in
@@ -60,7 +61,13 @@ module Make (S : Abstract.Storage.STORAGE) = struct
method list = SI.with_transaction storage (fun tx -> Atomic.get head |> M.keys tx)
- method find _ = failwith "TODO"
+ method find key =
+ let open Utilities.Result in
+ SI.with_transaction storage (fun tx ->
+ let* head = Atomic.get head |> M.lookup tx key in
+ match head with
+ | None -> Ok None
+ | Some head -> B.load tx storage key head |> Result.map Option.some)
end
let make storage label =