diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-10-02 22:36:49 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-10-02 22:36:49 -0300 |
| commit | 32e663591a84d095723e62ef934a0bc6e1470b52 (patch) | |
| tree | 60d6905606c4c5b829d51dcf95603d62df946f84 /lib/kernel/SubstantialRelation.ml | |
| parent | 9f8fe7b4e5891e848d035c240731fb578f6b33b5 (diff) | |
| parent | 73aec387d33626e33026432db5b1137b59edf0cf (diff) | |
| download | RNT-32e663591a84d095723e62ef934a0bc6e1470b52.tar.gz RNT-32e663591a84d095723e62ef934a0bc6e1470b52.zip | |
Merge branch 'relation-bipartite-registration'
Diffstat (limited to '')
| -rw-r--r-- | lib/kernel/SubstantialRelation.ml | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/kernel/SubstantialRelation.ml b/lib/kernel/SubstantialRelation.ml index 844b186..57bb79e 100644 --- a/lib/kernel/SubstantialRelation.ml +++ b/lib/kernel/SubstantialRelation.ml @@ -74,9 +74,17 @@ module Make (S : Abstract.Storage.STORAGE) = struct let* tuples = TupleSet.find tx relation.tuples in Option.to_result ~none:(Error.invalid_tuple_root relation.tuples) tuples - let schema_of tx relation = + let store_schema tx description = + Concepts.Encoding.Bencode.( + Dict + ( BatMap.String.bindings description + |> List.map (fun (name, {Protocols.Schematics.domain; _}) -> name, String domain) ) + |> to_blob ) + |> SI.store_blob tx + + let schema_of tx schematics = let open Utilities.Result in - let* data = SI.get_req tx (S.Hash relation.schematics) in + let* data = SI.get_req tx (S.Hash schematics) in let* fields = Concepts.Encoding.Bencode.of_blob data in let* kvs = Concepts.Encoding.Bencode.as_dict fields in kvs @@ -112,15 +120,17 @@ module Make (S : Abstract.Storage.STORAGE) = struct method enumerate = enumerate connection relation method protocols : Protocols.Handle.protocol list = - [ Protocols.Relation.make self; + [ Protocols.Addressable.make self; + Protocols.Relation.make self; Protocols.Enumerable.make self; Protocols.Schematics.make self ] method hash = encode relation |> Concepts.Hash.hash_of_blob + method address = self#hash end let load connection relation = - SI.with_read connection (fun tx -> schema_of tx relation) + SI.with_read connection (fun tx -> schema_of tx relation.schematics) |> Result.map (fun description -> new substantial_relation connection relation description |> Protocols.Handle.make ) |
