public class VBucketNodeLocator extends SpyObject implements NodeLocator
NodeLocator interface that contains vbucket
hashing methods.| Constructor and Description |
|---|
VBucketNodeLocator(java.util.List<MemcachedNode> nodes,
Config jsonConfig)
Construct a VBucketNodeLocator over the given JSON configuration string.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Collection<MemcachedNode> |
getAll()
Get all memcached nodes.
|
MemcachedNode |
getAlternative(java.lang.String k,
java.util.Collection<MemcachedNode> notMyVbucketNodes)
Method returns the node that is not contained in the specified collection
of the failed nodes.
|
MemcachedNode |
getPrimary(java.lang.String k)
Get the primary location for the given key.
|
NodeLocator |
getReadonlyCopy()
Create a read-only copy of this NodeLocator.
|
java.util.Iterator<MemcachedNode> |
getSequence(java.lang.String k)
Get an iterator over the sequence of nodes that make up the backup
locations for a given key.
|
MemcachedNode |
getServerByIndex(int k) |
int |
getVBucketIndex(java.lang.String key)
Returns a vbucket index for the given key.
|
void |
updateLocator(java.util.Collection<MemcachedNode> nodes,
Config newconf) |
void |
updateLocator(java.util.List<MemcachedNode> nodes)
Update locator status.
|
public VBucketNodeLocator(java.util.List<MemcachedNode> nodes, Config jsonConfig)
nodes - jsonConfig - public MemcachedNode getPrimary(java.lang.String k)
getPrimary in interface NodeLocatork - the object keypublic MemcachedNode getServerByIndex(int k)
public java.util.Iterator<MemcachedNode> getSequence(java.lang.String k)
getSequence in interface NodeLocatork - the object keypublic java.util.Collection<MemcachedNode> getAll()
getAll in interface NodeLocatorpublic NodeLocator getReadonlyCopy()
getReadonlyCopy in interface NodeLocatorpublic void updateLocator(java.util.List<MemcachedNode> nodes)
NodeLocatorupdateLocator in interface NodeLocatornodes - New locator nodes.public void updateLocator(java.util.Collection<MemcachedNode> nodes, Config newconf)
public int getVBucketIndex(java.lang.String key)
key - the keypublic MemcachedNode getAlternative(java.lang.String k, java.util.Collection<MemcachedNode> notMyVbucketNodes)
k - the keynotMyVbucketNodes - a collection of the nodes are excludedCopyright © 2006-2009 Dustin Sallings, 2009-2012 Couchbase, Inc.