public class KeyValueLocator extends Object implements Locator
Locator
responsible for locating the right node based on the partition of the
key.
Coming from 1.0, this locator has not really changed - only minor details have been modified in the refactoring process.
Constructor and Description |
---|
KeyValueLocator() |
Modifier and Type | Method and Description |
---|---|
void |
dispatch(Request<? extends Response> request,
List<Node> nodes,
ClusterConfig config,
CoreContext ctx)
Given the environment and node information, the implementation locates the right set of
nodes and dispatches the request into them.
|
static int |
partitionForKey(byte[] id,
int numPartitions)
Calculate the partition offset for the given key.
|
public void dispatch(Request<? extends Response> request, List<Node> nodes, ClusterConfig config, CoreContext ctx)
Locator
public static int partitionForKey(byte[] id, int numPartitions)
id
- the document id to calculate from.numPartitions
- the number of partitions in the bucket.Copyright © 2020 Couchbase, Inc.. All rights reserved.