diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-10-07 23:26:50 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-10-07 23:26:50 -0300 |
| commit | 483089803a411920fea7696ea6b40c664cf3003a (patch) | |
| tree | 7ac682a41db96203fc1bd7d5e1ed6daa76c93c4e /lib/protocols | |
| parent | 4c0c69dc571577e9c3ae68830c042cfaada603ae (diff) | |
| download | RNT-483089803a411920fea7696ea6b40c664cf3003a.tar.gz RNT-483089803a411920fea7696ea6b40c664cf3003a.zip | |
ephemeral literal, relation heading, subs rel stored & lmdb 1GB map
Diffstat (limited to '')
| -rw-r--r-- | lib/protocols/Relation.ml | 14 | ||||
| -rw-r--r-- | lib/protocols/Relation.mli | 3 |
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/protocols/Relation.ml b/lib/protocols/Relation.ml index b4cc4ec..9a6e739 100644 --- a/lib/protocols/Relation.ml +++ b/lib/protocols/Relation.ml @@ -18,15 +18,17 @@ let from handle = Handle.into handle (function Relation impl -> Some impl | _ -> let require handle = from handle |> Option.to_result ~none:(Error.not_a_relation ()) let contains i tuple = Handle.invoke i (fun o -> o#contains tuple) -let read relation = +let heading relation = let open Utilities.Result in let* schematics = Handle.require Schematics.from relation in let* description = Schematics.describe schematics in - let* heading = - match description with - | Schematics.Relation heading -> Ok heading - | _ -> Error (Error.not_a_relation ()) - in + match description with + | Schematics.Relation heading -> Ok heading + | _ -> Error (Error.not_a_relation ()) + +let read relation = + let open Utilities.Result in + let* heading = heading relation in let* enumerable = Enumerable.require relation in let* cursor = Enumerable.enumerate enumerable in Fun.protect diff --git a/lib/protocols/Relation.mli b/lib/protocols/Relation.mli index 87e6ab2..47d1d3e 100644 --- a/lib/protocols/Relation.mli +++ b/lib/protocols/Relation.mli @@ -9,6 +9,9 @@ val from : Handle.t -> t Handle.interface option val require : Handle.t -> (t Handle.interface, Concepts.Condition.condition) result val contains : t Handle.interface -> Concepts.Tuple.t -> (bool, Concepts.Condition.condition) result +(** the heading a relation describes itself with. *) +val heading : Handle.t -> (Schematics.relation_description, Concepts.Condition.condition) result + (** the heading and tuples of a relation, read whole. *) val read : Handle.t -> |
