diff options
| author | Estevan Castilho <tevo@riajuu.net> | 2026-09-11 04:06:52 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-11 01:06:52 -0300 |
| commit | b79224410f469a1cd4ff3be4f8e62d71398109fc (patch) | |
| tree | e025feebbdf9703ce790b4a97cb9997242c9bb4b /lib/kernel/SubstantialRelation.ml | |
| parent | efe8032f7e224c29fc67a4f8cfd52db908442eec (diff) | |
| download | RNT-b79224410f469a1cd4ff3be4f8e62d71398109fc.tar.gz RNT-b79224410f469a1cd4ff3be4f8e62d71398109fc.zip | |
Multigroup objects
Diffstat (limited to '')
| -rw-r--r-- | lib/kernel/SubstantialRelation.ml | 10 | ||||
| -rw-r--r-- | lib/kernel/SubstantialRelation.mli | 5 |
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/kernel/SubstantialRelation.ml b/lib/kernel/SubstantialRelation.ml index 8658f87..eebae3e 100644 --- a/lib/kernel/SubstantialRelation.ml +++ b/lib/kernel/SubstantialRelation.ml @@ -78,6 +78,9 @@ module Make (S : Abstract.Storage.STORAGE) = struct Ok {heading; predicate; local_constraints; tuples; indexes} end + let encode = Representation.to_blob + let decode = Representation.of_blob + let heading {heading; _} = heading let predicate {predicate; _} = predicate let local_constraints {local_constraints; _} = local_constraints @@ -133,10 +136,11 @@ module Make (S : Abstract.Storage.STORAGE) = struct let* data = SI.get_req tx (S.Hash addr) in Representation.of_blob data + let wrap conn relation = + new relation conn relation |> Protocols.Handle.make |> Result.ok + let load tx conn addr = - let open Utilities.Result in - let* relation = load_value tx addr in - Ok (new relation conn relation |> Protocols.Handle.make) + load_value tx addr |> Utilities.Result.fmap (wrap conn) let assert_tuple tx relation tuple = let open Utilities.Result in diff --git a/lib/kernel/SubstantialRelation.mli b/lib/kernel/SubstantialRelation.mli index db86fe2..9e61411 100644 --- a/lib/kernel/SubstantialRelation.mli +++ b/lib/kernel/SubstantialRelation.mli @@ -1,6 +1,9 @@ module Make (S : Abstract.Storage.STORAGE) : sig type t + val encode : t -> Concepts.Blob.t + val decode : Concepts.Blob.t -> (t, Concepts.Condition.condition) result + val empty : S.transaction -> heading:Concepts.Hash.hash -> @@ -23,6 +26,8 @@ module Make (S : Abstract.Storage.STORAGE) : sig val load_value : S.transaction -> Concepts.Hash.hash -> (t, Concepts.Condition.condition) result + val wrap : S.connection -> t -> (Protocols.Handle.t, Concepts.Condition.condition) result + val load : S.transaction -> S.connection -> |
