Storage: store rolls in subpathes named after their first 2 bytes
This commit is contained in:
parent
8b4c94de67
commit
99d8357115
@ -113,12 +113,20 @@ module Key = struct
|
|||||||
|
|
||||||
let public_keys = ["public_keys" ; "ed25519"]
|
let public_keys = ["public_keys" ; "ed25519"]
|
||||||
|
|
||||||
|
let nbyte_of_int32 i n =
|
||||||
|
Int32.to_string @@
|
||||||
|
Int32.logand (Int32.shift_left i (8 * n)) (Int32.of_int 0xff)
|
||||||
|
|
||||||
|
let roll_path roll l =
|
||||||
|
let i = Roll_repr.to_int32 roll in
|
||||||
|
nbyte_of_int32 i 0 :: nbyte_of_int32 i 1 :: Int32.to_string i :: l
|
||||||
|
|
||||||
module Roll = struct
|
module Roll = struct
|
||||||
let store_root l = store_root ("rolls" :: l)
|
let store_root l = store_root ("rolls" :: l)
|
||||||
let next = store_root [ "next" ]
|
let next = store_root [ "next" ]
|
||||||
let limbo = store_root [ "limbo" ]
|
let limbo = store_root [ "limbo" ]
|
||||||
let roll_store roll l =
|
let roll_store roll l =
|
||||||
store_root @@ Int32.to_string (Roll_repr.to_int32 roll) :: l
|
store_root @@ roll_path roll @@ l
|
||||||
let successor r = roll_store r ["successor"]
|
let successor r = roll_store r ["successor"]
|
||||||
let owner r = roll_store r ["owner"]
|
let owner r = roll_store r ["owner"]
|
||||||
end
|
end
|
||||||
@ -131,7 +139,7 @@ module Key = struct
|
|||||||
let random_seed c = cycle_store c [ "random_seed" ]
|
let random_seed c = cycle_store c [ "random_seed" ]
|
||||||
let reward_date c = cycle_store c [ "reward_date" ]
|
let reward_date c = cycle_store c [ "reward_date" ]
|
||||||
let roll_owner (c, r) =
|
let roll_owner (c, r) =
|
||||||
cycle_store c [ "roll_owners" ; Int32.to_string (Roll_repr.to_int32 r)]
|
cycle_store c @@ "roll_owners" :: roll_path r []
|
||||||
let unrevealed_nonce_hash l =
|
let unrevealed_nonce_hash l =
|
||||||
let c = l.Level_repr.cycle in
|
let c = l.Level_repr.cycle in
|
||||||
cycle_store c [ "unrevealed_nonce_hash" ;
|
cycle_store c [ "unrevealed_nonce_hash" ;
|
||||||
|
Loading…
Reference in New Issue
Block a user