Package com.couchbase.client.java.util
Class NodeLocatorHelper
java.lang.Object
com.couchbase.client.java.util.NodeLocatorHelper
Helper class to provide direct access on how document IDs are mapped onto nodes.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the target active node address for a given document ID on the bucket.Returns all target replica nodes which are currently available on the bucket.static NodeLocatorHelper
Creates a newNodeLocatorHelper
, mapped on to the givenBucket
.nodes()
Returns all nodes known in the current config.replicaNodeForId
(String id, int replicaNum) Returns the target replica node address for a given document ID and replica number on the bucket.Returns all target replica nodes addresses for a given document ID on the bucket.
-
Method Details
-
create
Creates a newNodeLocatorHelper
, mapped on to the givenBucket
. To make sure that the helper has a bucket config to work with in the beginning, it will callBucket.waitUntilReady(Duration)
with the duration provided as an argument. If you already did call waitUntilReady before initializing the helper, you can pass a duration of 0 in which case it will be omitted.- Parameters:
bucket
- the scoped bucket.waitUntilReadyDuration
- the duration used to call waitUntilReady (if 0 ignored).- Returns:
- the created locator.
-
activeNodeForId
Returns the target active node address for a given document ID on the bucket.- Parameters:
id
- the document id to convert.- Returns:
- the node for the given document id.
-
availableReplicaNodesForId
Returns all target replica nodes which are currently available on the bucket.- Parameters:
id
- the document ID to check.- Returns:
- the list of nodes for the given document ID.
-
replicaNodesForId
Returns all target replica nodes addresses for a given document ID on the bucket.- Parameters:
id
- the document id to convert.- Returns:
- the node for the given document id.
-
replicaNodeForId
Returns the target replica node address 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
Returns all nodes known in the current config.- Returns:
- all currently known nodes.
-