java.lang.Object
net.i2p.router.networkdb.kademlia.PeerSelector
- Direct Known Subclasses:
FloodfillPeerSelector
Abstract base class for peer selection in Kademlia routing tables.
All peer selection logic is implemented in FloodfillPeerSelector. This class only provides common constructor and logging functionality.
Field Summary
FieldsConstructor Summary
ConstructorsMethod Summary
All MethodsModifier and TypeMethodDescriptionselectNearest(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet<Hash> kbuckets) Peers nearest to the key in routing space.selectNearestExplicit(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet<Hash> kbuckets) Peers nearest to the key, floodfills first, then sorted by Kademlia distance.
Field Details
_log
_log. /._context
_context. /.
Constructor Details
PeerSelector
PeerSelector. /.- Parameters:
ctx- the router context whose log and profile organizer this selector uses
Method Details
selectNearest
abstract List<Hash> selectNearest(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet<Hash> kbuckets) Peers nearest to the key in routing space.- Parameters:
key- the routing key to search formaxNumRouters- the most hashes to return, zero or less meaning no limitpeersToIgnore- hashes already chosen or excluded from this selectionkbuckets- the routing table to select from- Returns:
- the nearest peers in ascending Kademlia distance
selectNearestExplicit
abstract List<Hash> selectNearestExplicit(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet<Hash> kbuckets) Peers nearest to the key, floodfills first, then sorted by Kademlia distance.- Parameters:
key- the routing key to search formaxNumRouters- the most hashes to return, zero or less meaning no limitpeersToIgnore- hashes already chosen or excluded from this selectionkbuckets- the routing table to select from- Returns:
- the floodfill peers nearest the key, then the other peers by distance