Package net.i2p.kademlia
Interface KBucket<T extends SimpleDataStructure>
-
- All Known Implementing Classes:
KBucketImpl
public interface KBucket<T extends SimpleDataStructure>
Group, without inherent ordering, a set of keys a certain distance away from a local key, using XOR as the distance metric Refactored from net.i2p.router.networkdb.kademlia- Since:
- 0.9.2 in i2psnark, moved to core in 0.9.10
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
add(T key)
Add the peer to the bucketvoid
clear()
Set<T>
getEntries()
Retrieve all routing table entries stored in the bucketvoid
getEntries(SelectionCollector<T> collector)
int
getKeyCount()
Number of keys already contained in this kbucketlong
getLastChanged()
The last-changed timestampint
getRangeBegin()
Lowest order high bit for difference keys.int
getRangeEnd()
Highest high bit for the difference keys.boolean
remove(T key)
Remove the key from the bucketvoid
setLastChanged()
Update the last-changed timestamp to now.
-
-
-
Method Detail
-
getRangeBegin
int getRangeBegin()
Lowest order high bit for difference keys. The lower-bounds distance of this bucket is 2**begin. If begin == 0, this is the closest bucket.
-
getRangeEnd
int getRangeEnd()
Highest high bit for the difference keys. The upper-bounds distance of this bucket is (2**(end+1)) - 1. If begin == end, the bucket cannot be split further. If end == (numbits - 1), this is the furthest bucket.
-
getKeyCount
int getKeyCount()
Number of keys already contained in this kbucket
-
add
boolean add(T key)
Add the peer to the bucket- Returns:
- true if added
-
remove
boolean remove(T key)
Remove the key from the bucket- Returns:
- true if the key existed in the bucket before removing it, else false
-
setLastChanged
void setLastChanged()
Update the last-changed timestamp to now.
-
getLastChanged
long getLastChanged()
The last-changed timestamp
-
getEntries
Set<T> getEntries()
Retrieve all routing table entries stored in the bucket- Returns:
- set of Hash structures
-
getEntries
void getEntries(SelectionCollector<T> collector)
-
clear
void clear()
-
-