Shell: document internal distributed_db error,
This commit is contained in:
parent
18765aa8ad
commit
4bd9a864cf
@ -20,7 +20,12 @@ type 'a request_param = {
|
||||
}
|
||||
|
||||
module Make_raw
|
||||
(Hash : sig type t end)
|
||||
(Hash : sig
|
||||
type t
|
||||
val name : string
|
||||
val encoding : t Data_encoding.t
|
||||
val pp : Format.formatter -> t -> unit
|
||||
end)
|
||||
(Disk_table :
|
||||
Distributed_db_functors.DISK_TABLE with type key := Hash.t)
|
||||
(Memory_table :
|
||||
@ -155,7 +160,14 @@ module Raw_operation_hashes = struct
|
||||
|
||||
include
|
||||
Make_raw
|
||||
(struct type t = Block_hash.t * int end)
|
||||
(struct
|
||||
type t = Block_hash.t * int
|
||||
let name = "raw_operation_hash"
|
||||
let pp ppf (h, n) = Format.fprintf ppf "%a:%d" Block_hash.pp h n
|
||||
let encoding =
|
||||
let open Data_encoding in
|
||||
obj2 (req "block" Block_hash.encoding) (req "index" uint16)
|
||||
end)
|
||||
(Operation_hashes_storage)
|
||||
(Operations_table)
|
||||
(struct
|
||||
@ -217,7 +229,14 @@ end
|
||||
module Raw_operations = struct
|
||||
include
|
||||
Make_raw
|
||||
(struct type t = Block_hash.t * int end)
|
||||
(struct
|
||||
type t = Block_hash.t * int
|
||||
let name = "raw_operation"
|
||||
let pp ppf (h, n) = Format.fprintf ppf "%a:%d" Block_hash.pp h n
|
||||
let encoding =
|
||||
let open Data_encoding in
|
||||
obj2 (req "block" Block_hash.encoding) (req "index" uint16)
|
||||
end)
|
||||
(Operations_storage)
|
||||
(Operations_table)
|
||||
(struct
|
||||
|
@ -70,7 +70,12 @@ module type PRECHECK = sig
|
||||
end
|
||||
|
||||
module Make_table
|
||||
(Hash : sig type t end)
|
||||
(Hash : sig
|
||||
type t
|
||||
val name : string
|
||||
val encoding : t Data_encoding.t
|
||||
val pp : Format.formatter -> t -> unit
|
||||
end)
|
||||
(Disk_table : DISK_TABLE with type key := Hash.t)
|
||||
(Memory_table : MEMORY_TABLE with type key := Hash.t)
|
||||
(Scheduler : SCHEDULER_EVENTS with type key := Hash.t)
|
||||
@ -123,6 +128,17 @@ end = struct
|
||||
|
||||
type error += Missing_data of key
|
||||
|
||||
let () =
|
||||
Error_monad.register_error_kind `Permanent
|
||||
~id: ("distributed_db." ^ Hash.name ^ ".missing")
|
||||
~title: ("Missing " ^ Hash.name)
|
||||
~description: ("Some " ^ Hash.name ^ " is missing from the distributed db")
|
||||
~pp: (fun ppf key ->
|
||||
Format.fprintf ppf "Missing %s %a" Hash.name Hash.pp key)
|
||||
(Data_encoding.obj1 (Data_encoding.req "key" Hash.encoding))
|
||||
(function Missing_data key -> Some key | _ -> None)
|
||||
(fun key -> Missing_data key)
|
||||
|
||||
let read s k =
|
||||
match Memory_table.find s.memory k with
|
||||
| exception Not_found ->
|
||||
|
@ -71,7 +71,12 @@ module type PRECHECK = sig
|
||||
end
|
||||
|
||||
module Make_table
|
||||
(Hash : sig type t end)
|
||||
(Hash : sig
|
||||
type t
|
||||
val name : string
|
||||
val encoding : t Data_encoding.t
|
||||
val pp : Format.formatter -> t -> unit
|
||||
end)
|
||||
(Disk_table : DISK_TABLE with type key := Hash.t)
|
||||
(Memory_table : MEMORY_TABLE with type key := Hash.t)
|
||||
(Scheduler : SCHEDULER_EVENTS with type key := Hash.t)
|
||||
|
Loading…
Reference in New Issue
Block a user