@Stability.Uncommitted public class NodeLocatorHelper extends Object
Modifier and Type | Method and Description |
---|---|
String |
activeNodeForId(String id)
Returns the target active node address for a given document ID on the bucket.
|
List<String> |
availableReplicaNodesForId(String id)
Returns all target replica nodes which are currently available on the bucket.
|
static NodeLocatorHelper |
create(Bucket bucket,
Duration waitUntilReadyDuration)
Creates a new
NodeLocatorHelper , mapped on to the given Bucket . |
List<String> |
nodes()
Returns all nodes known in the current config.
|
String |
replicaNodeForId(String id,
int replicaNum)
Returns the target replica node address for a given document ID and replica number on the bucket.
|
List<String> |
replicaNodesForId(String id)
Returns all target replica nodes addresses for a given document ID on the bucket.
|
public static NodeLocatorHelper create(Bucket bucket, Duration waitUntilReadyDuration)
NodeLocatorHelper
, mapped on to the given Bucket
.
To make sure that the helper has a bucket config to work with in the beginning, it will call
Bucket.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.bucket
- the scoped bucket.waitUntilReadyDuration
- the duration used to call waitUntilReady (if 0 ignored).public String activeNodeForId(String id)
id
- the document id to convert.public List<String> availableReplicaNodesForId(String id)
id
- the document ID to check.public List<String> replicaNodesForId(String id)
id
- the document id to convert.public String replicaNodeForId(String id, int replicaNum)
id
- the document id to convert.replicaNum
- the replica number.Copyright © 2024 Couchbase, Inc.. All rights reserved.