Class LocalChordNode

java.lang.Object
org.drasyl.handler.dht.chord.LocalChordNode
All Implemented Interfaces:
RemoteChordNode

public class LocalChordNode extends Object implements RemoteChordNode
Our local Chord node.

This class is based on Chord implementation of Chuan Xia.

  • Field Details

    • BIND_NAME

      public static final String BIND_NAME
  • Constructor Details

  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • checkAlive

      public io.netty.util.concurrent.Future<Void> checkAlive()
      Description copied from interface: RemoteChordNode
      NOOP/ping method used to check if callee is still alive.
      Specified by:
      checkAlive in interface RemoteChordNode
    • getPredecessor

      public io.netty.util.concurrent.Future<DrasylAddress> getPredecessor()
      Description copied from interface: RemoteChordNode
      Returns the predecessor.
      Specified by:
      getPredecessor in interface RemoteChordNode
    • getSuccessor

      public io.netty.util.concurrent.Future<DrasylAddress> getSuccessor()
      Description copied from interface: RemoteChordNode
      Returns the successor.
      Specified by:
      getSuccessor in interface RemoteChordNode
    • offerAsPredecessor

      public io.netty.util.concurrent.Future<Void> offerAsPredecessor()
      Description copied from interface: RemoteChordNode
      Offers callee to set caller as new predecessor.
      Specified by:
      offerAsPredecessor in interface RemoteChordNode
    • findSuccessor

      public io.netty.util.concurrent.Future<DrasylAddress> findSuccessor(long id)
      Description copied from interface: RemoteChordNode
      Find successor for id.

      n.find_successor(id)

      Specified by:
      findSuccessor in interface RemoteChordNode
    • isStable

      public io.netty.util.concurrent.Future<Boolean> isStable()
      Description copied from interface: RemoteChordNode
      Check if node is stable (has successor and predecessor or neither).
      Specified by:
      isStable in interface RemoteChordNode
    • findClosestFingerPreceding

      public io.netty.util.concurrent.Future<DrasylAddress> findClosestFingerPreceding(long id)
      Description copied from interface: RemoteChordNode
      Find the closest finger preceding.

      n.closest_preceding_finger(id)

      Specified by:
      findClosestFingerPreceding in interface RemoteChordNode
    • join

      public io.netty.util.concurrent.Future<Void> join(DrasylAddress contact)
      Join circle by contacting contact.
    • checkIfPredecessorIsAlive

      public io.netty.util.concurrent.Future<Void> checkIfPredecessorIsAlive()
      Returns a successfully completed future if our predecessor is alive or we do not have a predecessor. Otherwise, the future will fail.
    • stabilize

      public io.netty.util.concurrent.Future<Void> stabilize()
      verify my immediate successor, and tell the successor about me.
    • fixFinger

      public io.netty.util.concurrent.Future<Void> fixFinger(int i)