diff options
Diffstat (limited to 'lib/kernel')
| -rw-r--r-- | lib/kernel/Merkle.ml | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/kernel/Merkle.ml b/lib/kernel/Merkle.ml index 6f342cd..49f4fda 100644 --- a/lib/kernel/Merkle.ml +++ b/lib/kernel/Merkle.ml @@ -339,3 +339,11 @@ module Interface : INTERFACE = functor (S : Abstract.Storage.STORAGE) (K : KEY) | Some addr -> retrieve tx addr end + +module StringKey : KEY with type t = string = struct + type t = string + + let encode s = String.to_bytes s |> Concepts.Representation.blob_of_bytes + let compare s1 s2 = String.compare s1 s2 |> Concepts.Ordering.of_int + let decode b = Concepts.Representation.bytes_of_blob b |> String.of_bytes |> Result.ok +end |
