Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/peermanager.h
Show First 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | public: | ||||
bool updateNextRequestTime(NodeId nodeid, TimePoint timeout); | bool updateNextRequestTime(NodeId nodeid, TimePoint timeout); | ||||
/** | /** | ||||
* Randomly select a node to poll. | * Randomly select a node to poll. | ||||
*/ | */ | ||||
NodeId selectNode(); | NodeId selectNode(); | ||||
/** | /** | ||||
* Update the peer set when a nw block is connected. | * Update the peer set when a new block is connected. | ||||
*/ | */ | ||||
void updatedBlockTip(); | void updatedBlockTip(); | ||||
/**************************************************** | /**************************************************** | ||||
* Functions which are public for testing purposes. * | * Functions which are public for testing purposes. * | ||||
****************************************************/ | ****************************************************/ | ||||
/** | /** | ||||
* Provide the PeerId associated with the given proof. If the peer does not | * Provide the PeerId associated with the given proof. If the peer does not | ||||
* exists, then it is created. | * exist, then it is created. | ||||
*/ | */ | ||||
PeerId getPeerId(const Proof &proof); | PeerId getPeerId(const Proof &proof); | ||||
/** | /** | ||||
* Remove an existing peer. | * Remove an existing peer. | ||||
*/ | */ | ||||
bool removePeer(const PeerId peerid); | bool removePeer(const PeerId peerid); | ||||
/** | /** | ||||
* Randomly select a peer to poll. | * Randomly select a peer to poll. | ||||
*/ | */ | ||||
PeerId selectPeer() const; | PeerId selectPeer() const; | ||||
/** | /** | ||||
* Trigger maintenance of internal datastructures. | * Trigger maintenance of internal data structures. | ||||
* Returns how much slot space was saved after compaction. | * Returns how much slot space was saved after compaction. | ||||
*/ | */ | ||||
uint64_t compact(); | uint64_t compact(); | ||||
/** | /** | ||||
* Perform consistency check on internal data structures. | * Perform consistency check on internal data structures. | ||||
*/ | */ | ||||
bool verify() const; | bool verify() const; | ||||
// Accssors. | // Accessors. | ||||
uint64_t getSlotCount() const { return slotCount; } | uint64_t getSlotCount() const { return slotCount; } | ||||
uint64_t getFragmentation() const { return fragmentation; } | uint64_t getFragmentation() const { return fragmentation; } | ||||
std::vector<Peer> getPeers() const; | std::vector<Peer> getPeers() const; | ||||
std::vector<NodeId> getNodeIdsForPeer(PeerId peerId) const; | std::vector<NodeId> getNodeIdsForPeer(PeerId peerId) const; | ||||
private: | private: | ||||
PeerSet::iterator fetchOrCreatePeer(const Proof &proof); | PeerSet::iterator fetchOrCreatePeer(const Proof &proof); | ||||
Show All 13 Lines |