RPC: block validator worker introspection
This commit is contained in:
parent
6d3f5af163
commit
50b1957714
@ -568,6 +568,24 @@ module Workers = struct
|
||||
|
||||
end
|
||||
|
||||
module Block_validator = struct
|
||||
|
||||
let state =
|
||||
let open Data_encoding in
|
||||
RPC_service.post_service
|
||||
~description:"Introspect the state of the block_validator worker."
|
||||
~query: RPC_query.empty
|
||||
~error: Data_encoding.empty
|
||||
~input: empty
|
||||
~output:
|
||||
(Worker_types.full_status_encoding
|
||||
Block_validator_worker_state.Request.encoding
|
||||
(Block_validator_worker_state.Event.encoding Error.encoding)
|
||||
Error.encoding)
|
||||
RPC_path.(root / "workers" / "block_validator")
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
@ -188,6 +188,19 @@ module Workers : sig
|
||||
RPC_service.t
|
||||
|
||||
end
|
||||
|
||||
module Block_validator : sig
|
||||
|
||||
open Block_validator_worker_state
|
||||
|
||||
val state :
|
||||
([ `POST ], unit,
|
||||
unit, unit, unit,
|
||||
(Request.view, Event.t) Worker_types.full_status, unit)
|
||||
RPC_service.t
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
module Network : sig
|
||||
|
@ -471,6 +471,18 @@ let build_rpc_directory node =
|
||||
backlog = Prevalidator.last_events w ;
|
||||
current_request = Prevalidator.current_request w }) in
|
||||
|
||||
(* Workers : Block_validator *)
|
||||
|
||||
let dir =
|
||||
RPC_directory.register0 dir Services.Workers.Block_validator.state
|
||||
(fun () () ->
|
||||
let w = Block_validator.running_worker () in
|
||||
RPC_answer.return
|
||||
{ Worker_types.status = Block_validator.status w ;
|
||||
pending_requests = Block_validator.pending_requests w ;
|
||||
backlog = Block_validator.last_events w ;
|
||||
current_request = Block_validator.current_request w }) in
|
||||
|
||||
(* Network : Global *)
|
||||
|
||||
let dir =
|
||||
|
Loading…
Reference in New Issue
Block a user