Shell: add rpc to trigget a Get_current_event

This commit is contained in:
Marco Stronati 2018-11-22 15:44:14 +01:00 committed by Grégoire Henry
parent fc42bd5a91
commit 0b98dbd472
No known key found for this signature in database
GPG Key ID: 50D984F20BD445D2
3 changed files with 28 additions and 0 deletions

View File

@ -461,6 +461,13 @@ module Make(Proto: Registered_protocol.T)(Arg: ARG): T = struct
Operation_hash.Map.map map_op pv.pending ;
}) ;
dir := RPC_directory.register !dir
(Proto_services.S.Mempool.request_operations RPC_path.open_root)
(fun pv () () ->
Distributed_db.Request.current_head pv.chain_db () ;
return_unit
) ;
dir := RPC_directory.gen_register !dir
(Proto_services.S.Mempool.monitor_operations RPC_path.open_root)
begin fun { applied ; refusals = refused ; branch_refusals = branch_refused ; branch_delays = branch_delayed ; operation_stream } params () ->

View File

@ -736,6 +736,14 @@ module Make(Proto : PROTO)(Next_proto : PROTO) = struct
~output: (list next_operation_encoding)
RPC_path.(path / "monitor_operations")
let request_operations path =
RPC_service.post_service
~description:"Request the operations of your peers."
~input: Data_encoding.empty
~query: RPC_query.empty
~output: Data_encoding.empty
RPC_path.(path / "request_operations")
end
let live_blocks =
@ -945,6 +953,9 @@ module Make(Proto : PROTO)(Next_proto : PROTO) = struct
end)
()
let request_operations ctxt ?(chain = `Main) () =
let s = S.Mempool.request_operations (mempool_path chain_path) in
RPC_context.make_call1 s ctxt chain () ()
end
let live_blocks ctxt =

View File

@ -261,6 +261,11 @@ module Make(Proto : PROTO)(Next_proto : PROTO) : sig
?refused:bool ->
unit -> (Next_proto.operation list Lwt_stream.t * stopper) tzresult Lwt.t
val request_operations:
#simple ->
?chain:chain ->
unit -> unit tzresult Lwt.t
end
val live_blocks:
@ -417,6 +422,11 @@ module Make(Proto : PROTO)(Next_proto : PROTO) : sig
unit,
Next_proto.operation list) RPC_service.t
val request_operations :
('a, 'b) RPC_path.t ->
([ `POST ], 'a,
'b , unit, unit, unit) RPC_service.t
end
val live_blocks: