Package com.couchbase.client.java.util
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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description InetAddressactiveNodeForId(String id)Returns the target active nodeInetAddressfor a given document ID on the bucket.static NodeLocatorHelpercreate(Bucket bucket)Creates a newNodeLocatorHelper, mapped on to the givenBucket.List<InetAddress>nodes()Returns all nodes known in the current config.InetAddressreplicaNodeForId(String id, int replicaNum)Returns the target replica nodeInetAddressfor a given document ID and replica number on the bucket.List<InetAddress>replicaNodesForId(String id)Returns all target replica nodesInetAddressfor a given document ID on the bucket.
-
-
-
Method Detail
-
create
public static NodeLocatorHelper create(Bucket bucket)
Creates a newNodeLocatorHelper, mapped on to the givenBucket.- Parameters:
bucket- the scoped bucket.- Returns:
- the created locator.
-
activeNodeForId
public InetAddress activeNodeForId(String id)
Returns the target active nodeInetAddressfor 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 nodesInetAddressfor 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 nodeInetAddressfor 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.
-
-