|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.router.networkdb.kademlia.KBucketImpl
class KBucketImpl
Constructor Summary | |
---|---|
KBucketImpl(I2PAppContext context,
Hash local)
for testing - use above constructor for production to get common caching |
|
KBucketImpl(I2PAppContext context,
LocalHash local)
|
Method Summary | |
---|---|
int |
add(Hash peer)
Todo: shuffling here is a hack and doesn't work since we switched back to a HashSet implementation |
Hash |
generateRandomKey()
Generate a random key to go within this bucket WARNING - Something is seriously broken here. |
java.util.Set<Hash> |
getEntries()
Retrieve all routing table entries stored in the bucket |
void |
getEntries(SelectionCollector collector)
|
java.util.Set<Hash> |
getEntries(java.util.Set toIgnoreHashes)
Retrieve hashes stored in the bucket, excluding the ones specified |
int |
getKeyCount()
Number of keys already contained in this kbuckey |
LocalHash |
getLocal()
|
int |
getRangeBegin()
lowest order high bit for difference keys |
Hash |
getRangeBeginKey()
|
int |
getRangeEnd()
highest high bit for the difference keys |
Hash |
getRangeEndKey()
|
static void |
main(java.lang.String[] args)
Test harness to make sure its assigning keys to the right buckets WARNING - Something is seriously broken here. |
boolean |
remove(Hash peer)
Remove the key from the bucket |
void |
setEntries(java.util.Set<Hash> entries)
Fill the bucket with entries |
void |
setRange(int lowOrderBitLimit,
int highOrderBitLimit)
Set the range low and high bits for difference keys |
boolean |
shouldContain(Hash key)
whether or not the key qualifies as part of this bucket |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public KBucketImpl(I2PAppContext context, LocalHash local)
public KBucketImpl(I2PAppContext context, Hash local)
Method Detail |
---|
public int getRangeBegin()
KBucket
getRangeBegin
in interface KBucket
public int getRangeEnd()
KBucket
getRangeEnd
in interface KBucket
public void setRange(int lowOrderBitLimit, int highOrderBitLimit)
KBucket
setRange
in interface KBucket
public int getKeyCount()
KBucket
getKeyCount
in interface KBucket
public LocalHash getLocal()
getLocal
in interface KBucket
public boolean shouldContain(Hash key)
KBucket
shouldContain
in interface KBucket
public java.util.Set<Hash> getEntries()
KBucket
getEntries
in interface KBucket
public java.util.Set<Hash> getEntries(java.util.Set toIgnoreHashes)
KBucket
getEntries
in interface KBucket
public void getEntries(SelectionCollector collector)
getEntries
in interface KBucket
public void setEntries(java.util.Set<Hash> entries)
KBucket
setEntries
in interface KBucket
entries
- set of Hash structurespublic int add(Hash peer)
add
in interface KBucket
public boolean remove(Hash peer)
KBucket
remove
in interface KBucket
public Hash generateRandomKey()
generateRandomKey
in interface KBucket
public Hash getRangeBeginKey()
public Hash getRangeEndKey()
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |