diff options
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 -> |
