#include <rpc.hpp>
|
| template<typename Request , typename Response > |
| static void | read (std::shared_ptr< libp2p::basic::ReadWriter > read_writer, std::function< outcome::result< Response >(Request)> cb, std::function< void(outcome::result< void >)> error_cb) |
| |
| template<typename Request > |
| static void | read (std::shared_ptr< libp2p::basic::ReadWriter > read_writer, std::function< void(outcome::result< Request >)> cb) |
| |
| template<typename Request , typename Response > |
| static void | write (libp2p::Host &host, const libp2p::peer::PeerInfo &peer_info, const libp2p::peer::Protocol &protocol, Request request, std::function< void(outcome::result< Response >)> cb) |
| |
| template<typename Request > |
| static void | write (libp2p::Host &host, const libp2p::peer::PeerInfo &peer_info, const libp2p::peer::Protocol &protocol, Request request, std::function< void(outcome::result< void >)> cb) |
| |
template<typename MessageReadWriterT>
struct kagome::network::RPC< MessageReadWriterT >
Works with RPC requests-responses through the Libp2p
- Template Parameters
-
Definition at line 27 of file rpc.hpp.
template<typename MessageReadWriterT >
template<typename Request , typename Response >
| static void kagome::network::RPC< MessageReadWriterT >::read |
( |
std::shared_ptr< libp2p::basic::ReadWriter > |
read_writer, |
|
|
std::function< outcome::result< Response >(Request)> |
cb, |
|
|
std::function< void(outcome::result< void >)> |
error_cb |
|
) |
| |
|
inlinestatic |
Read an RPC request and answer with a response
- Template Parameters
-
| Request | - type of the request to be read |
| Response | - type of the response to be written |
- Parameters
-
| read_writer | - channel, from which to read and to which to write |
| cb,which | is called, when the request is read; it is expected that this function will return a corresponding response |
| error_cb,which | is called, when error happens during read/write or message processing |
Definition at line 39 of file rpc.hpp.
template<typename MessageReadWriterT >
template<typename Request >
| static void kagome::network::RPC< MessageReadWriterT >::read |
( |
std::shared_ptr< libp2p::basic::ReadWriter > |
read_writer, |
|
|
std::function< void(outcome::result< Request >)> |
cb |
|
) |
| |
|
inlinestatic |
Read an RPC request
- Template Parameters
-
| Request | - type of the request to be read |
- Parameters
-
| read_writer | - channel, from which to read |
| cb,which | is called, when the request is read |
| error_cb,which | is called, when error happens |
Definition at line 74 of file rpc.hpp.
template<typename MessageReadWriterT >
template<typename Request , typename Response >
| static void kagome::network::RPC< MessageReadWriterT >::write |
( |
libp2p::Host & |
host, |
|
|
const libp2p::peer::PeerInfo & |
peer_info, |
|
|
const libp2p::peer::Protocol & |
protocol, |
|
|
Request |
request, |
|
|
std::function< void(outcome::result< Response >)> |
cb |
|
) |
| |
|
inlinestatic |
Write an RPC request and wait for a response
- Template Parameters
-
| Request | - type of the request to be written |
| Response | - type of the response to be read |
- Parameters
-
| host,using | which to communicate with the network |
| peer_info | of the peer we want to write the request to |
| protocol,over | which we want to write the request to |
| request | we want to write |
| cb,which | is called, when a response arrives, or error happens |
Definition at line 99 of file rpc.hpp.
template<typename MessageReadWriterT >
template<typename Request >
| static void kagome::network::RPC< MessageReadWriterT >::write |
( |
libp2p::Host & |
host, |
|
|
const libp2p::peer::PeerInfo & |
peer_info, |
|
|
const libp2p::peer::Protocol & |
protocol, |
|
|
Request |
request, |
|
|
std::function< void(outcome::result< void >)> |
cb |
|
) |
| |
|
inlinestatic |
Write an RPC request
- Template Parameters
-
| Request | - type of the request to be written |
- Parameters
-
| host,using | which to communicate with the network |
| peer_info | of the peer we want to write the request to |
| protocol,over | which we want to write the request to |
| request | we want to write |
| cb,which | is called, when a response arrives, or error happens |
Definition at line 161 of file rpc.hpp.
The documentation for this struct was generated from the following file: