6 #ifndef KAGOME_NETWORK_BLOCKANNOUNCEPROTOCOL 7 #define KAGOME_NETWORK_BLOCKANNOUNCEPROTOCOL 13 #include <libp2p/connection/stream.hpp> 14 #include <libp2p/host/host.hpp> 37 public std::enable_shared_from_this<BlockAnnounceProtocol>,
47 std::shared_ptr<StreamEngine> stream_engine,
48 std::shared_ptr<blockchain::BlockTree> block_tree,
49 std::shared_ptr<BlockAnnounceObserver> observer,
50 std::shared_ptr<PeerManager> peer_manager);
52 bool start()
override;
62 std::function<
void(outcome::result<std::shared_ptr<Stream>>)> &&cb)
71 void readStatus(std::shared_ptr<Stream> stream,
73 std::function<
void(outcome::result<void>)> &&cb);
77 std::function<
void(outcome::result<void>)> &&cb);
82 "BlockAnnounceProtocol"s;
93 #endif // KAGOME_NETWORK_BLOCKANNOUNCEPROTOCOL KAGOME_DECLARE_CACHE(BlockAnnounceProtocol, KAGOME_CACHE_UNIT(BlockAnnounce))
const application::AppConfiguration & app_config_
std::shared_ptr< blockchain::BlockTree > block_tree_
void onIncomingStream(std::shared_ptr< Stream > stream) override
outcome::result< Status > createStatus() const
#define KAGOME_CACHE_UNIT(type)
void newOutgoingStream(const PeerInfo &peer_info, std::function< void(outcome::result< std::shared_ptr< Stream >>)> &&cb) override
~BlockAnnounceProtocol() override=default
libp2p::peer::PeerInfo PeerInfo
void readAnnounce(std::shared_ptr< Stream > stream)
void blockAnnounce(BlockAnnounce &&announce)
void writeStatus(std::shared_ptr< Stream > stream, Direction direction, std::function< void(outcome::result< void >)> &&cb)
static const auto kBlockAnnounceProtocolName
std::shared_ptr< StreamEngine > stream_engine_
std::shared_ptr< PeerManager > peer_manager_
BlockAnnounceProtocol()=delete
const std::string & protocolName() const override
void readStatus(std::shared_ptr< Stream > stream, Direction direction, std::function< void(outcome::result< void >)> &&cb)
std::shared_ptr< BlockAnnounceObserver > observer_