net.i2p.router.networkdb.kademlia

## Class PeerSelector

- java.lang.Object
- - net.i2p.router.networkdb.kademlia.PeerSelector

- Direct Known Subclasses:
    FloodfillPeerSelector

      abstract class PeerSelector
      extends Object

  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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected RouterContext` | `_context`
    `protected Log` | `_log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PeerSelector(RouterContext ctx)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) abstract List<Hash>` | `selectMostReliablePeers(Hash key, int numClosest, Set<Hash> alreadyChecked, KBucketSet<Hash> kbuckets)`
    `(package private) abstract List<Hash>` | `selectNearest(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet<Hash> kbuckets)`
    `(package private) abstract List<Hash>` | `selectNearestExplicit(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet<Hash> kbuckets)`
    `(package private) abstract List<Hash>` | `selectNearestExplicitThin(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet<Hash> kbuckets)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### _context

          protected final RouterContext _context

    - #### _log

          protected final Log _log

  - ### Constructor Detail

    - #### PeerSelector

          public PeerSelector(RouterContext ctx)

  - ### Method Detail

    - #### selectMostReliablePeers

          abstract List<Hash> selectMostReliablePeers(Hash key,
                                                      int numClosest,
                                                      Set<Hash> alreadyChecked,
                                                      KBucketSet<Hash> kbuckets)

    - #### selectNearest

          abstract List<Hash> selectNearest(Hash key,
                                            int maxNumRouters,
                                            Set<Hash> peersToIgnore,
                                            KBucketSet<Hash> kbuckets)

    - #### selectNearestExplicit

          abstract List<Hash> selectNearestExplicit(Hash key,
                                                    int maxNumRouters,
                                                    Set<Hash> peersToIgnore,
                                                    KBucketSet<Hash> kbuckets)

    - #### selectNearestExplicitThin

          abstract List<Hash> selectNearestExplicitThin(Hash key,
                                                        int maxNumRouters,
                                                        Set<Hash> peersToIgnore,
                                                        KBucketSet<Hash> kbuckets)