|
My Project 3.7.9
C++ Distributed Hash Table
|
Public Types | |
| using | ServiceDiscoveredCallback = std::function<void(msgpack::object&&, SockAddr&&)> |
Public Member Functions | |
| PeerDiscovery (in_port_t port=DEFAULT_PORT, std::shared_ptr< asio::io_context > ioContext={}, std::shared_ptr< Logger > logger={}) | |
| void | startDiscovery (std::string_view type, ServiceDiscoveredCallback callback) |
| template<typename T> | |
| void | startDiscovery (std::string_view type, std::function< void(T &&, SockAddr &&)> cb) |
| void | startPublish (std::string_view type, const msgpack::sbuffer &pack_buf) |
| void | startPublish (sa_family_t domain, std::string_view type, const msgpack::sbuffer &pack_buf) |
| template<typename T> | |
| void | startPublish (std::string_view type, const T &object) |
| void | stop () |
| bool | stopDiscovery (std::string_view type) |
| bool | stopPublish (std::string_view type) |
| bool | stopPublish (sa_family_t domain, std::string_view type) |
| void | connectivityChanged () |
| void | stopConnectivityChanged () |
Static Public Attributes | |
| static constexpr in_port_t | DEFAULT_PORT = 8888 |
Definition at line 20 of file peer_discovery.h.
| using dht::PeerDiscovery::ServiceDiscoveredCallback = std::function<void(msgpack::object&&, SockAddr&&)> |
Definition at line 24 of file peer_discovery.h.
| void dht::PeerDiscovery::startDiscovery | ( | std::string_view | type, |
| ServiceDiscoveredCallback | callback ) |
startDiscovery - Keep Listening data from the sender until node is joinned or stop is called
|
inline |
Definition at line 38 of file peer_discovery.h.
| void dht::PeerDiscovery::startPublish | ( | std::string_view | type, |
| const msgpack::sbuffer & | pack_buf ) |
startPublish - Keeping sending data until node is joinned or stop is called
|
inline |
Definition at line 50 of file peer_discovery.h.
| void dht::PeerDiscovery::stop | ( | ) |
Thread Stopper
| bool dht::PeerDiscovery::stopDiscovery | ( | std::string_view | type | ) |
Remove possible callBack to discovery
| bool dht::PeerDiscovery::stopPublish | ( | std::string_view | type | ) |
Remove different serivce message to send
|
staticconstexpr |
Definition at line 23 of file peer_discovery.h.