net.i2p.router.networkdb.kademlia
Class FloodfillPeerSelector
java.lang.Object
net.i2p.router.networkdb.kademlia.PeerSelector
net.i2p.router.networkdb.kademlia.FloodfillPeerSelector
- class FloodfillPeerSelector
- extends PeerSelector
Method Summary |
protected java.math.BigInteger |
getDistance(Hash targetKey,
Hash routerInQuestion)
|
java.util.List |
selectFloodfillParticipants(KBucketSet kbuckets)
|
java.util.List |
selectMostReliablePeers(Hash key,
int numClosest,
java.util.Set alreadyChecked,
KBucketSet kbuckets)
Search through the kbucket set to find the most reliable peers close to the
given key, skipping all of the ones already checked |
java.util.List |
selectNearest(Hash key,
int maxNumRouters,
java.util.Set peersToIgnore,
KBucketSet kbuckets)
Generic KBucket filtering to find the hashes close to a key, regardless of other considerations. |
java.util.List |
selectNearestExplicit(Hash key,
int maxNumRouters,
java.util.Set peersToIgnore,
KBucketSet kbuckets)
Ignore KBucket ordering and do the XOR explicitly per key. |
java.util.List |
selectNearestExplicitThin(Hash key,
int maxNumRouters,
java.util.Set peersToIgnore,
KBucketSet kbuckets)
Pick out peers with the floodfill capacity set, returning them first, but then
after they're complete, sort via kademlia. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_log
protected Log _log
_context
protected RouterContext _context
FloodfillPeerSelector
public FloodfillPeerSelector(RouterContext ctx)
selectNearestExplicitThin
public java.util.List selectNearestExplicitThin(Hash key,
int maxNumRouters,
java.util.Set peersToIgnore,
KBucketSet kbuckets)
- Pick out peers with the floodfill capacity set, returning them first, but then
after they're complete, sort via kademlia.
- Overrides:
selectNearestExplicitThin
in class PeerSelector
- Returns:
- List of Hash for the peers selected
selectFloodfillParticipants
public java.util.List selectFloodfillParticipants(KBucketSet kbuckets)
selectMostReliablePeers
public java.util.List selectMostReliablePeers(Hash key,
int numClosest,
java.util.Set alreadyChecked,
KBucketSet kbuckets)
- Search through the kbucket set to find the most reliable peers close to the
given key, skipping all of the ones already checked
- Returns:
- ordered list of Hash objects
selectNearestExplicit
public java.util.List selectNearestExplicit(Hash key,
int maxNumRouters,
java.util.Set peersToIgnore,
KBucketSet kbuckets)
- Ignore KBucket ordering and do the XOR explicitly per key. Runs in O(n*log(n))
time (n=routing table size with c ~ 32 xor ops). This gets strict ordering
on closest
- Returns:
- List of Hash for the peers selected, ordered by bucket (but intra bucket order is not defined)
getDistance
protected java.math.BigInteger getDistance(Hash targetKey,
Hash routerInQuestion)
selectNearest
public java.util.List selectNearest(Hash key,
int maxNumRouters,
java.util.Set peersToIgnore,
KBucketSet kbuckets)
- Generic KBucket filtering to find the hashes close to a key, regardless of other considerations.
This goes through the kbuckets, starting with the key's location, moving towards us, and then away from the
key's location's bucket, selecting peers until we have numClosest.
- Returns:
- List of Hash for the peers selected, ordered by bucket (but intra bucket order is not defined)