Skip to content

Commit 289249c

Browse files
committed
irmin-tezos: simplify the way we serialise nodes
The awkward order is not necessary anymore since irmin 1.4 and no such order exists in the wild.
1 parent 880c839 commit 289249c

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

src/irmin-tezos/schema.ml

+2-17
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,6 @@ struct
7676

7777
type entry = string * M.value
7878

79-
(* Irmin 1.4 uses int8 to store filename lengths.
80-
81-
Irmin 2 use a variable-size encoding for strings; this is using int8
82-
for strings of size stricly less than 128 (e.g. 2^7) which happen to
83-
be the case for all filenames ever produced by Irmin 1.4. *)
84-
let step_t = Irmin.Type.string
85-
8679
let metadata_t =
8780
let some = "\255\000\000\000\000\000\000\000" in
8881
let none = "\000\000\000\000\000\000\000\000" in
@@ -103,23 +96,15 @@ struct
10396
let open Irmin.Type in
10497
record "Tree.entry" (fun _ _ _ -> assert false)
10598
|+ field "kind" metadata_t metadata_of_entry
106-
|+ field "name" step_t fst
99+
|+ field "name" string fst
107100
|+ field "hash" Hash.t hash_of_entry
108101
|> sealr
109102

110103
let entries_t : entry list Irmin.Type.t =
111104
Irmin.Type.(list ~len:`Int64 entry_t)
112105

113106
let pre_hash_entries = Irmin.Type.(unstage (pre_hash entries_t))
114-
let compare_entry (x, _) (y, _) = String.compare x y
115-
let step_to_string = Irmin.Type.(unstage (to_bin_string Path.step_t))
116-
let str_key (k, v) = (step_to_string k, v)
117-
118-
let pre_hash t =
119-
M.list t
120-
|> List.map str_key
121-
|> List.fast_sort compare_entry
122-
|> pre_hash_entries
107+
let pre_hash t = M.list t |> pre_hash_entries
123108
end
124109

125110
include M

0 commit comments

Comments
 (0)