Kagome
Polkadot Runtime Engine in C++17
protocol_req_collation.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_NETWORK_REQCOLLATIONPROTOCOL
7 #define KAGOME_NETWORK_REQCOLLATIONPROTOCOL
8 
10 
11 #include <memory>
12 
13 #include <libp2p/connection/stream.hpp>
14 #include <libp2p/host/host.hpp>
15 
18 #include "log/logger.hpp"
20 #include "network/peer_manager.hpp"
23 #include "network/types/roles.hpp"
24 #include "network/types/status.hpp"
25 #include "utils/non_copyable.hpp"
26 
27 namespace kagome::network {
28 
29  struct ReqCollationProtocolImpl;
30 
33  NonMovable {
34  public:
35  ReqCollationProtocol() = delete;
36  ~ReqCollationProtocol() override = default;
37 
39  application::AppConfiguration const &app_config,
40  application::ChainSpec const &chain_spec,
41  std::shared_ptr<ReqCollationObserver> observer);
42 
43  const Protocol &protocolName() const override;
44 
45  bool start() override;
46  bool stop() override;
47 
48  void onIncomingStream(std::shared_ptr<Stream> stream) override;
49  void newOutgoingStream(
50  const PeerInfo &peer_info,
51  std::function<void(outcome::result<std::shared_ptr<Stream>>)> &&cb)
52  override;
53 
54  void request(const PeerId &peer_id,
56  std::function<void(outcome::result<CollationFetchingResponse>)>
57  &&response_handler) override;
58 
59  private:
60  std::shared_ptr<ReqCollationProtocolImpl> impl_;
61  };
62 
63 } // namespace kagome::network
64 
65 #endif // KAGOME_NETWORK_REQCOLLATIONPROTOCOL
std::shared_ptr< ReqCollationProtocolImpl > impl_
void request(const PeerId &peer_id, CollationFetchingRequest request, std::function< void(outcome::result< CollationFetchingResponse >)> &&response_handler) override
void onIncomingStream(std::shared_ptr< Stream > stream) override
~ReqCollationProtocol() override=default
libp2p::peer::PeerInfo PeerInfo
libp2p::peer::Protocol Protocol
libp2p::peer::PeerId PeerId
void newOutgoingStream(const PeerInfo &peer_info, std::function< void(outcome::result< std::shared_ptr< Stream >>)> &&cb) override
const Protocol & protocolName() const override