From 5a1088413468f171886d39339a8de96697af64c5 Mon Sep 17 00:00:00 2001 From: Estevan Castilho Date: Thu, 24 Sep 2026 02:17:01 +0000 Subject: Multigroup registration stub --- lib/kernel/Multigroup.ml | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'lib/kernel/Multigroup.ml') diff --git a/lib/kernel/Multigroup.ml b/lib/kernel/Multigroup.ml index e5e36cf..c8ffa62 100644 --- a/lib/kernel/Multigroup.ml +++ b/lib/kernel/Multigroup.ml @@ -38,7 +38,7 @@ module Make (S : Abstract.Storage.STORAGE) = struct let encode = Representation.to_blob let decode = Representation.of_blob - class multigroup conn value node = object + class multigroup conn value node = object (self) inherit Lifecycle.null method to_string = "multigroup" @@ -48,15 +48,18 @@ module Make (S : Abstract.Storage.STORAGE) = struct val node = node (* FIXME: see the comment on Branch.ml *) method protocols : Protocols.Handle.protocol list = - [ Prototype.Directory.of_properties - [ "relation", Prototype.mixture - [ RMDirectory.make - ~storage ~node - ~constructor:(R.wrap storage) ] ] ] + Protocols.[ Addressable.make self; + Prototype.Directory.of_properties + [ "relation", Prototype.mixture + [ RMDirectory.make + ~storage ~node + ~constructor:(R.wrap storage) ] ] ] method hash = Representation.to_blob multigroup |> Concepts.Hash.hash_of_blob + + method address = self#hash end let wrap conn value = @@ -64,4 +67,12 @@ module Make (S : Abstract.Storage.STORAGE) = struct let* node = SI.with_transaction conn (fun tx -> RelationM.find tx value.relations) |> fmap (Option.to_result ~none:(Error.incomplete_multigroup value.relations)) in new multigroup conn value node |> Protocols.Handle.make |> Result.ok + + let make conn = + let open Utilities.Result in + SI.with_transaction conn (fun tx -> + let* empty = RelationM.empty_under tx in + let multigroup = { relations = empty } in + let* _ = SI.store_blob tx (Representation.to_blob multigroup) in + new multigroup conn multigroup RelationM.empty |> Protocols.Handle.make |> Result.ok) end -- cgit v1.2.3