From 1259773fac4d7c334351c61ab8cf71231c1af4ef Mon Sep 17 00:00:00 2001 From: Estevan Castilho Date: Thu, 3 Sep 2026 02:23:27 +0000 Subject: Branch registration --- lib/kernel/Branch.ml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'lib/kernel/Branch.ml') diff --git a/lib/kernel/Branch.ml b/lib/kernel/Branch.ml index 2aaa9ca..31442f6 100644 --- a/lib/kernel/Branch.ml +++ b/lib/kernel/Branch.ml @@ -52,9 +52,27 @@ module Make (S : Abstract.Storage.STORAGE) = struct Ok { multigroups; previous } end - class branch = object - (* TODO *) + class branch storage value = object + inherit Lifecycle.null + + val storage : S.connection = storage + val branch : t = value + + method protocols : Protocols.Handle.protocol list = [] + + method hash = + Representation.to_blob branch + |> Concepts.Hash.hash_of_blob end - let load _tx _conn _name _addr = failwith "TODO" + let load tx conn addr = + let open Utilities.Result in + let* data = SI.get_req tx (S.Hash addr) in + let* branch = Representation.of_blob data in + Ok (new branch conn branch |> Protocols.Handle.make) + + let make conn = + let open Utilities.Result in + let* empty = SI.with_transaction conn MultigroupM.empty_under in + Ok (new branch conn { multigroups = empty; previous = None } |> Protocols.Handle.make) end -- cgit v1.2.3