diff options
| author | Estevan Castilho <tevo@riajuu.net> | 2026-08-15 00:09:22 +0000 |
|---|---|---|
| committer | Estevan Castilho <tevo@riajuu.net> | 2026-08-23 03:06:56 +0000 |
| commit | 5a4f7d5ed6e5d6b2711db316e8de06cea78b54ec (patch) | |
| tree | 5a6372324f12858775848e169eace7be52a86101 /lib/kernel | |
| parent | 403f1a62f66c33a7d39c17704f34debe579c89b0 (diff) | |
| download | RNT-5a4f7d5ed6e5d6b2711db316e8de06cea78b54ec.tar.gz RNT-5a4f7d5ed6e5d6b2711db316e8de06cea78b54ec.zip | |
Allow storage backend addresses to be labels rather than hashes
Diffstat (limited to 'lib/kernel')
| -rw-r--r-- | lib/kernel/Initialization.ml | 4 | ||||
| -rw-r--r-- | lib/kernel/Merkle.ml | 10 | ||||
| -rw-r--r-- | lib/kernel/Storage.ml | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/lib/kernel/Initialization.ml b/lib/kernel/Initialization.ml index a27539f..fc7c51a 100644 --- a/lib/kernel/Initialization.ml +++ b/lib/kernel/Initialization.ml @@ -34,7 +34,7 @@ module Make (Store : Abstract.Storage.STORAGE) = struct let read_in_transaction tx = let open Utilities.Result in - let* fixed = Store.get tx fixed_label_address in + let* fixed = Store.get tx (Store.Hash fixed_label_address) in match fixed with | None -> Ok None | Some fixed -> @@ -45,7 +45,7 @@ module Make (Store : Abstract.Storage.STORAGE) = struct | None -> Error (Error.missing_branch_index root) end - let store_fixed_root tx root = Store.put tx fixed_label_address (address_to_blob root) + let store_fixed_root tx root = Store.put tx (Store.Hash fixed_label_address) (address_to_blob root) let create_initial_branch_state tx = let open Utilities.Result in diff --git a/lib/kernel/Merkle.ml b/lib/kernel/Merkle.ml index 49f4fda..60a10a7 100644 --- a/lib/kernel/Merkle.ml +++ b/lib/kernel/Merkle.ml @@ -118,7 +118,7 @@ module Make : TREE = functor (S : Abstract.Storage.STORAGE) (K : KEY) -> struct let find tx node = let open Utilities.Result in - let* data = S.get tx node in + let* data = S.get tx (S.Hash node) in match data with | None -> Ok None | Some data -> @@ -146,7 +146,7 @@ module Make : TREE = functor (S : Abstract.Storage.STORAGE) (K : KEY) -> struct let open Utilities.Result in let data = to_blob node in let addr = Concepts.Hash.hash_of_blob data in - let* () = S.put tx addr data in + let* () = S.put tx (S.Hash addr) data in Ok addr let empty_under tx = persist tx empty @@ -286,7 +286,7 @@ module Make : TREE = functor (S : Abstract.Storage.STORAGE) (K : KEY) -> struct end module type INTERFACE = functor (S : Abstract.Storage.STORAGE) (K : KEY) (V : VALUE) -> sig - type address + type address = Concepts.Hash.hash type node val find : S.transaction -> address -> (node option, Concepts.Condition.condition) result @@ -311,11 +311,11 @@ module Interface : INTERFACE = functor (S : Abstract.Storage.STORAGE) (K : KEY) let intern tx v = let data = V.encode v in let addr = Concepts.Hash.hash_of_blob data in - let* () = S.put tx addr data in + let* () = S.put tx (S.Hash addr) data in Ok addr let retrieve tx addr = - let* data = S.get tx addr in + let* data = S.get tx (S.Hash addr) in match data with | None -> Ok None | Some data -> diff --git a/lib/kernel/Storage.ml b/lib/kernel/Storage.ml index 952b306..376d839 100644 --- a/lib/kernel/Storage.ml +++ b/lib/kernel/Storage.ml @@ -16,7 +16,7 @@ module Make (S : Abstract.Storage.STORAGE) = struct let store_blob tx blob = let open Utilities.Result in let address = Concepts.Hash.hash_of_blob blob in - let* () = S.put tx address blob in + let* () = S.put tx (S.Hash address) blob in Ok address end |
