Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.i2p.router.networkdb.kademlia
Class KBucketSet

    java.lang.Object
      net.i2p.router.networkdb.kademlia.KBucketSet

     class KBucketSet

extends Object

In memory storage of buckets sorted by the XOR metric from the local router's identity, with bucket N containing routers BASE^N through BASE^N+1 away, up through 2^256 bits away (since we use SHA256).

Field Summary
`static int` | `BASE`
`static int` | `BUCKET_SIZE`
`static int` | `KEYSIZE_BITS`
`static int` | `NUM_BUCKETS`

Constructor Summary
`KBucketSet(I2PAppContext context, Hash us)`

Method Summary
`boolean` | `add(Hash peer)` Return true if the peer is new to the bucket it goes in, or false if it was already in it
`protected KBucket` | `createBucket(int start, int end)`
`protected void` | `createBuckets()`
`void` | `displayBuckets()`
`Set<Hash>` | `getAll()`
`void` | `getAll(SelectionCollector collector)`
`Set<Hash>` | `getAll(Set<Hash> toIgnore)`
`KBucket` | `getBucket(int bucket)`
`static void` | `main(String[] args)`
`int` | `pickBucket(Hash key)`
`boolean` | `remove(Hash entry)`
`int` | `size()` Not an exact count (due to concurrency issues) but generally correct
`String` | `toString()`
`(package private) static String` | `toString(byte[] b)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### BASE

    public static final int BASE

See Also:
  Constant Field Values

### KEYSIZE_BITS

    public static final int KEYSIZE_BITS

See Also:
  Constant Field Values

### NUM_BUCKETS

    public static final int NUM_BUCKETS

See Also:
  Constant Field Values

### BUCKET_SIZE

    public static final int BUCKET_SIZE

See Also:
  Constant Field Values

Constructor Detail

### KBucketSet

    public KBucketSet(I2PAppContext context,
                      Hash us)

Method Detail

### add

    public boolean add(Hash peer)

  Return true if the peer is new to the bucket it goes in, or false if it was already in it

### size

    public int size()

  Not an exact count (due to concurrency issues) but generally correct

### remove

    public boolean remove(Hash entry)

### getAll

    public Set<Hash> getAll()

### getAll

    public Set<Hash> getAll(Set<Hash> toIgnore)

### getAll

    public void getAll(SelectionCollector collector)

### pickBucket

    public int pickBucket(Hash key)

### getBucket

    public KBucket getBucket(int bucket)

### createBuckets

    protected void createBuckets()

### createBucket

    protected KBucket createBucket(int start,
                                   int end)

### displayBuckets

    public void displayBuckets()

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### toString

    static final String toString(byte[] b)

### main

    public static void main(String[] args)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD