Class NodeLocatorHelper

java.lang.Object
com.couchbase.client.java.util.NodeLocatorHelper

@Uncommitted
@Public
public class NodeLocatorHelper
extends Object
Helper class to provide direct access on how document IDs are mapped onto nodes.
Since:
2.1.0
Author:
Michael Nitschinger
  • Method Details

    • create

      public static NodeLocatorHelper create​(Bucket bucket)
      Creates a new NodeLocatorHelper, mapped on to the given Bucket.
      Parameters:
      bucket - the scoped bucket.
      Returns:
      the created locator.
    • activeNodeForId

      public InetAddress activeNodeForId​(String id)
      Returns the target active node InetAddress for a given document ID on the bucket.
      Parameters:
      id - the document id to convert.
      Returns:
      the node for the given document id.
    • replicaNodesForId

      public List<InetAddress> replicaNodesForId​(String id)
      Returns all target replica nodes InetAddress for a given document ID on the bucket.
      Parameters:
      id - the document id to convert.
      Returns:
      the node for the given document id.
    • replicaNodeForId

      public InetAddress replicaNodeForId​(String id, int replicaNum)
      Returns the target replica node InetAddress for a given document ID and replica number on the bucket.
      Parameters:
      id - the document id to convert.
      replicaNum - the replica number.
      Returns:
      the node for the given document id.
    • nodes

      public List<InetAddress> nodes()
      Returns all nodes known in the current config.
      Returns:
      all currently known nodes.