Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/peermanager.h
Show First 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | public: | ||||
PeerId getPeer(const Proof &proof); | PeerId getPeer(const Proof &proof); | ||||
bool removePeer(const PeerId peerid); | bool removePeer(const PeerId peerid); | ||||
bool rescorePeer(const PeerId peerid, uint32_t score); | bool rescorePeer(const PeerId peerid, uint32_t score); | ||||
/** | /** | ||||
* Node API. | * Node API. | ||||
*/ | */ | ||||
bool addNode(const Proof &proof, NodeId nodeid, const CPubKey &pubkey); | bool addNode(NodeId nodeid, const Proof &proof, const CPubKey &pubkey); | ||||
bool removeNode(NodeId nodeid); | bool removeNode(NodeId nodeid); | ||||
bool forNode(NodeId nodeid, std::function<bool(const Node &n)> func) const; | bool forNode(NodeId nodeid, std::function<bool(const Node &n)> func) const; | ||||
bool updateNextRequestTime(NodeId nodeid, TimePoint timeout); | bool updateNextRequestTime(NodeId nodeid, TimePoint timeout); | ||||
NodeId selectNode(); | NodeId selectNode(); | ||||
Show All 12 Lines | public: | ||||
* Perform consistency check on internal data structures. | * Perform consistency check on internal data structures. | ||||
* Mostly useful for tests. | * Mostly useful for tests. | ||||
*/ | */ | ||||
bool verify() const; | bool verify() const; | ||||
// Accssors. | // Accssors. | ||||
uint64_t getSlotCount() const { return slotCount; } | uint64_t getSlotCount() const { return slotCount; } | ||||
uint64_t getFragmentation() const { return fragmentation; } | uint64_t getFragmentation() const { return fragmentation; } | ||||
private: | |||||
PeerId addPeer(PeerId peerid, uint32_t score); | |||||
}; | }; | ||||
/** | /** | ||||
* This is an internal method that is exposed for testing purposes. | * This is an internal method that is exposed for testing purposes. | ||||
*/ | */ | ||||
PeerId selectPeerImpl(const std::vector<Slot> &slots, const uint64_t slot, | PeerId selectPeerImpl(const std::vector<Slot> &slots, const uint64_t slot, | ||||
const uint64_t max); | const uint64_t max); | ||||
} // namespace avalanche | } // namespace avalanche | ||||
#endif // BITCOIN_AVALANCHE_PEERMANAGER_H | #endif // BITCOIN_AVALANCHE_PEERMANAGER_H |