aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/SubstantialRelation.ml
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-10-31 02:55:39 -0300
committerMarcos Magueta <maguetamarcos@gmail.com>2026-10-31 02:55:39 -0300
commitb42d12cfc0b663085bd5ae9e5e2d491e727e731e (patch)
treef3b9cee2fecab374823031d788b0e20237eb8c29 /lib/kernel/SubstantialRelation.ml
parentf27915b4784d64ceb2d2ebbcf7296c74f33a96ca (diff)
downloadRNT-b42d12cfc0b663085bd5ae9e5e2d491e727e731e.tar.gz
RNT-b42d12cfc0b663085bd5ae9e5e2d491e727e731e.zip
range on the interface fold, stopping at the first error
Diffstat (limited to 'lib/kernel/SubstantialRelation.ml')
-rw-r--r--lib/kernel/SubstantialRelation.ml20
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/kernel/SubstantialRelation.ml b/lib/kernel/SubstantialRelation.ml
index 193df98..e89b008 100644
--- a/lib/kernel/SubstantialRelation.ml
+++ b/lib/kernel/SubstantialRelation.ml
@@ -61,7 +61,7 @@ module Make (S : Abstract.Storage.STORAGE) = struct
end
module TupleSet = Merkle.Interface (S) (TupleKey) (TupleValue)
- module Index = Merkle.Make (S) (Merkle.StringKey)
+ module Index = Merkle.Interface (S) (Merkle.StringKey) (TupleValue)
type t =
{ schematics: Concepts.Hash.hash;
@@ -150,19 +150,15 @@ module Make (S : Abstract.Storage.STORAGE) = struct
BatMap.String.find_opt attribute relation.indexes
|> Option.to_result ~none:(Error.unindexed_attribute attribute)
in
- let prefix = prefix value in
+ let start = prefix value in
reading connection
(fun tx -> Index.find tx root |>> Option.to_result ~none:(Error.invalid_index_root root))
(fun tx node ~yield ->
- Index.fold_left ~from:prefix
- ~until:(fun key -> not (String.starts_with ~prefix key))
+ Index.fold_left ~from:start
+ ~until:(fun key -> not (String.starts_with ~prefix:start key))
tx
- (fun read _ address ->
- let* () = read in
- let* tuple = SI.get_req tx (S.Hash address) |>> TupleValue.decode in
- Ok (yield tuple) )
- (Ok ()) node
- |> Result.join )
+ (fun () _ tuple -> yield tuple)
+ () node )
class substantial_relation connection value description =
object (self)
@@ -223,8 +219,8 @@ module Make (S : Abstract.Storage.STORAGE) = struct
^ Concepts.Hash.to_raw_string hash,
hash ) )
hashed
- |> Index.of_list tx
- |> Result.map (fun node -> attribute, Index.hash_of node)
+ |> Index.Tree.of_list tx
+ |> Result.map (fun node -> attribute, Index.Tree.hash_of node)
let store tx description tuples =
let open Utilities.Result in