diff options
Diffstat (limited to 'lib/kernel')
| -rw-r--r-- | lib/kernel/BranchIndex.ml | 2 | ||||
| -rw-r--r-- | lib/kernel/BranchIndex.mli | 2 | ||||
| -rw-r--r-- | lib/kernel/Initialization.ml | 2 | ||||
| -rw-r--r-- | lib/kernel/Merkle.ml | 5 |
4 files changed, 6 insertions, 5 deletions
diff --git a/lib/kernel/BranchIndex.ml b/lib/kernel/BranchIndex.ml index d1efa9a..00bd44d 100644 --- a/lib/kernel/BranchIndex.ml +++ b/lib/kernel/BranchIndex.ml @@ -21,8 +21,8 @@ module Make (Store : Abstract.Storage.STORAGE) = struct type tree = Tree.node let empty = Tree.empty + let empty_under = Tree.empty_under let hash_of = Tree.hash_of - let persist = Tree.persist let find = Tree.find let find_branch = Tree.lookup let put_branch = Tree.insert diff --git a/lib/kernel/BranchIndex.mli b/lib/kernel/BranchIndex.mli index 5a867bf..ec7bfc7 100644 --- a/lib/kernel/BranchIndex.mli +++ b/lib/kernel/BranchIndex.mli @@ -9,8 +9,8 @@ module Make (Store : Abstract.Storage.STORAGE) : sig type tree val empty : tree + val empty_under : Store.transaction -> (address, Concepts.Condition.condition) result val hash_of : tree -> root - val persist : Store.transaction -> tree -> (root, Concepts.Condition.condition) result val find : Store.transaction -> root -> (tree option, Concepts.Condition.condition) result val find_branch : diff --git a/lib/kernel/Initialization.ml b/lib/kernel/Initialization.ml index d84a29e..a27539f 100644 --- a/lib/kernel/Initialization.ml +++ b/lib/kernel/Initialization.ml @@ -52,7 +52,7 @@ module Make (Store : Abstract.Storage.STORAGE) = struct (* The first branch state has no synthetic "genesis" commit. Both [current] and [history] point at persisted empty trees; the runtime mounts /system around those roots after initialization. *) - let* empty_root = Branch_index.persist tx Branch_index.empty in + let* empty_root = Branch_index.empty_under tx in Concepts.BranchState.make ~current:empty_root ~history:empty_root ~tip:None |> Concepts.BranchState.to_blob |> S.store_blob tx diff --git a/lib/kernel/Merkle.ml b/lib/kernel/Merkle.ml index 5bd427f..6f342cd 100644 --- a/lib/kernel/Merkle.ml +++ b/lib/kernel/Merkle.ml @@ -19,11 +19,10 @@ module type TREE = functor (S : Abstract.Storage.STORAGE) (K : KEY) -> sig val find : S.transaction -> address -> (node option, Concepts.Condition.condition) result val empty : node + val empty_under : S.transaction -> (address, Concepts.Condition.condition) result val hash_of : node -> address - val persist : S.transaction -> node -> (address, Concepts.Condition.condition) result - val insert : S.transaction -> K.t -> address -> node -> (node, Concepts.Condition.condition) result val remove : S.transaction -> K.t -> node -> (node, Concepts.Condition.condition) result val lookup : S.transaction -> K.t -> node -> (address option, Concepts.Condition.condition) result @@ -150,6 +149,8 @@ module Make : TREE = functor (S : Abstract.Storage.STORAGE) (K : KEY) -> struct let* () = S.put tx addr data in Ok addr + let empty_under tx = persist tx empty + type op = Update of address * node | Split of address * K.t * address let emplace i v ft = |
