Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/peermanager.h
Show First 20 Lines • Show All 251 Lines • ▼ Show 20 Lines | public: | ||||
uint64_t getFragmentation() const { return fragmentation; } | uint64_t getFragmentation() const { return fragmentation; } | ||||
ProofRef getProof(const ProofId &proofid) const; | ProofRef getProof(const ProofId &proofid) const; | ||||
bool isBoundToPeer(const ProofId &proofid) const; | bool isBoundToPeer(const ProofId &proofid) const; | ||||
bool isOrphan(const ProofId &proofid) const; | bool isOrphan(const ProofId &proofid) const; | ||||
private: | private: | ||||
void moveToOrphan(const ProofRef &proof); | void moveToOrphan(const ProofRef &proof); | ||||
bool createPeer(const ProofRef &proof); | bool createPeer(const ProofRef &proof, std::chrono::seconds cooldown); | ||||
bool addOrUpdateNode(const PeerSet::iterator &it, NodeId nodeid); | bool addOrUpdateNode(const PeerSet::iterator &it, NodeId nodeid); | ||||
bool addNodeToPeer(const PeerSet::iterator &it); | bool addNodeToPeer(const PeerSet::iterator &it); | ||||
bool removeNodeFromPeer(const PeerSet::iterator &it, uint32_t count = 1); | bool removeNodeFromPeer(const PeerSet::iterator &it, uint32_t count = 1); | ||||
friend struct ::avalanche::TestPeerManager; | friend struct ::avalanche::TestPeerManager; | ||||
}; | }; | ||||
/** | /** | ||||
* Internal methods that are exposed for testing purposes. | * Internal methods that are 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 |