Interface DHTRouter

All Known Implementing Classes:
DHTRouterImpl, DHTRouterWrapper

public interface DHTRouter
  • Method Details

    • getK

      int getK()
    • getID

      byte[] getID()
    • isID

      boolean isID(byte[] node_id)
    • getLocalContact

      DHTRouterContact getLocalContact()
    • setAdapter

      void setAdapter(DHTRouterAdapter _adapter)
    • seed

      void seed()
      Tells the router to perform its "start of day" functions required to integrate it into the DHT (search for itself, refresh buckets)
    • contactKnown

      void contactKnown(byte[] node_id, DHTRouterContactAttachment attachment, boolean force)
      Adds a contact to the router. The contact is not known to be alive (e.g. we've been returned the contact by someone but we've not either got a reply from it, nor has it invoked us.
      Parameters:
      node_id -
      attachment -
    • contactAlive

      void contactAlive(byte[] node_id, DHTRouterContactAttachment attachment)
      Adds a contact to the router and marks it as "known to be alive"
      Parameters:
      node_id -
      attachment -
    • contactDead

      DHTRouterContact contactDead(byte[] node_id, boolean force)
      Informs the router that an attempt to interact with the contact failed
      Parameters:
      node_id -
      attachment -
      Returns:
    • findContact

      DHTRouterContact findContact(byte[] node_id)
    • findClosestContacts

      List<DHTRouterContact> findClosestContacts(byte[] node_id, int num_to_return, boolean live_only)
      Returns num_to_return or a few more closest contacts, unordered
    • recordLookup

      void recordLookup(byte[] node_id)
    • requestPing

      boolean requestPing(byte[] node_id)
    • refreshIdleLeaves

      void refreshIdleLeaves(long idle_max)
    • refreshRandom

      byte[] refreshRandom()
    • findBestContacts

      List<DHTRouterContact> findBestContacts(int max)
      returns a list of best contacts in terms of uptime, best first
      Parameters:
      max -
      Returns:
    • getAllContacts

      List<DHTRouterContact> getAllContacts()
      Returns a list of DHTRouterContact objects
      Returns:
    • getStats

      DHTRouterStats getStats()
    • setSleeping

      void setSleeping(boolean sleeping)
    • setSuspended

      void setSuspended(boolean susp)
    • destroy

      void destroy()
    • print

      void print()
    • addObserver

      boolean addObserver(DHTRouterObserver rto)
      Adds a routing table observer if it is not already observing.
      Parameters:
      rto - the observer to add
      Returns:
      true if now observing, false otherwise
    • containsObserver

      boolean containsObserver(DHTRouterObserver rto)
      Returns whether the given observer is already observing.
      Parameters:
      rto - the observer to query as observing
      Returns:
      true if observing, false otherwise
    • removeObserver

      boolean removeObserver(DHTRouterObserver rto)
      Removes the observer if it is already observing.
      Parameters:
      rto - the observer to remove
      Returns:
      true if no longer observing, false otherwise