blob: d1efa9a3ef55146f0223722ed0c201ff8696f3f9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
type address = Concepts.Hash.hash
type root = address
type branch_name = string
type branch_state_root = address
let default_branch_name = "master"
module Branch_name = struct
type t = branch_name
let encode name = Concepts.Codec.Bencode.(String name |> to_blob)
let compare left right = Concepts.Ordering.of_int (String.compare left right)
let decode blob =
Concepts.Codec.Bencode.of_blob blob |> Utilities.Result.fmap Concepts.Codec.Bencode.as_string
end
module Make (Store : Abstract.Storage.STORAGE) = struct
module Tree = Merkle.Make (Store) (Branch_name)
type tree = Tree.node
let empty = Tree.empty
let hash_of = Tree.hash_of
let persist = Tree.persist
let find = Tree.find
let find_branch = Tree.lookup
let put_branch = Tree.insert
end
|