diff options
| author | Estevan Castilho <tevo@riajuu.net> | 2026-09-03 02:23:27 +0000 |
|---|---|---|
| committer | Estevan Castilho <tevo@riajuu.net> | 2026-09-03 02:23:51 +0000 |
| commit | 1259773fac4d7c334351c61ab8cf71231c1af4ef (patch) | |
| tree | 941d59334c04c1f4794ef16e4904cb7dafaa6b72 /lib/kernel/Branch.ml | |
| parent | cad153992e5ead450ae8245e518c6c88fe778ac1 (diff) | |
| download | RNT-1259773fac4d7c334351c61ab8cf71231c1af4ef.tar.gz RNT-1259773fac4d7c334351c61ab8cf71231c1af4ef.zip | |
Branch registration
Diffstat (limited to 'lib/kernel/Branch.ml')
| -rw-r--r-- | lib/kernel/Branch.ml | 24 |
1 files changed, 21 insertions, 3 deletions
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 |
