Shell/mempool: add identifiers to Worker.Name instances

This commit is contained in:
Raphaël Proust 2018-11-14 13:27:22 +08:00 committed by MBourgoin
parent 6a14afc1b0
commit 8ba2bc2001
No known key found for this signature in database
GPG Key ID: 4B3F7008ABB5B2D0
2 changed files with 16 additions and 12 deletions

View File

@ -226,7 +226,12 @@ module Make (Mempool_worker: Mempool_worker.T)
module Name = struct module Name = struct
type t = P2p_peer.Id.t type t = P2p_peer.Id.t
let encoding = P2p_peer.Id.encoding let encoding = P2p_peer.Id.encoding
let base = [ "node.mempool.peer_worker" ] let base =
let proto_hash =
let _: string = Format.flush_str_formatter () in
Format.fprintf Format.str_formatter "%a" Protocol_hash.pp Proto.hash;
Format.flush_str_formatter () in
[ "node"; "mempool"; "peer_worker"; proto_hash ]
let pp = P2p_peer.Id.pp let pp = P2p_peer.Id.pp
end end

View File

@ -142,16 +142,15 @@ module Make(Static: STATIC)(Proto: Registered_protocol.T)
end) end)
module Name = struct module Name = struct
type t = Chain_id.t * Protocol_hash.t type t = Chain_id.t
let encoding = let encoding = Chain_id.encoding
Data_encoding.tup2 let base =
Chain_id.encoding let proto_hash =
Protocol_hash.encoding let _: string = Format.flush_str_formatter () in
let base = [ "validator.mempool" ] Format.fprintf Format.str_formatter "%a" Protocol_hash.pp Proto.hash;
let pp fmt (chain_id, proto_hash) = Format.flush_str_formatter () in
Chain_id.pp_short fmt chain_id; [ "node"; "mempool"; "worker"; proto_hash ]
Format.pp_print_string fmt "."; let pp = Chain_id.pp_short
Protocol_hash.pp_short fmt proto_hash
end end
module Request = struct module Request = struct
@ -563,7 +562,7 @@ module Make(Static: STATIC)(Proto: Registered_protocol.T)
(Worker.launch (Worker.launch
table table
limits.worker_limits limits.worker_limits
(chain_id, Proto.hash) chain_id
{ limits ; chain_db ; validation_state } { limits ; chain_db ; validation_state }
(module Handlers) >>= return) (module Handlers) >>= return)