com.couchbase.client.vbucket
Class VBucketNodeLocator

java.lang.Object
  extended by net.spy.memcached.compat.SpyObject
      extended by com.couchbase.client.vbucket.VBucketNodeLocator
All Implemented Interfaces:
net.spy.memcached.NodeLocator

public class VBucketNodeLocator
extends net.spy.memcached.compat.SpyObject
implements net.spy.memcached.NodeLocator

Implementation of the NodeLocator interface that contains vbucket hashing methods.


Constructor Summary
VBucketNodeLocator(java.util.List<net.spy.memcached.MemcachedNode> nodes, Config jsonConfig)
          Construct a VBucketNodeLocator over the given JSON configuration string.
 
Method Summary
 java.util.Collection<net.spy.memcached.MemcachedNode> getAll()
          
 net.spy.memcached.MemcachedNode getAlternative(java.lang.String k, java.util.Collection<net.spy.memcached.MemcachedNode> notMyVbucketNodes)
          Method returns the node that is not contained in the specified collection of the failed nodes.
 net.spy.memcached.MemcachedNode getPrimary(java.lang.String k)
          
 net.spy.memcached.NodeLocator getReadonlyCopy()
          
 java.util.Iterator<net.spy.memcached.MemcachedNode> getSequence(java.lang.String k)
          
 net.spy.memcached.MemcachedNode getServerByIndex(int k)
           
 int getVBucketIndex(java.lang.String key)
          Returns a vbucket index for the given key.
 void updateLocator(java.util.Collection<net.spy.memcached.MemcachedNode> nodes, Config newconf)
           
 void updateLocator(java.util.List<net.spy.memcached.MemcachedNode> nodes)
           
 
Methods inherited from class net.spy.memcached.compat.SpyObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VBucketNodeLocator

public VBucketNodeLocator(java.util.List<net.spy.memcached.MemcachedNode> nodes,
                          Config jsonConfig)
Construct a VBucketNodeLocator over the given JSON configuration string.

Parameters:
nodes -
jsonConfig -
Method Detail

getPrimary

public net.spy.memcached.MemcachedNode getPrimary(java.lang.String k)

Specified by:
getPrimary in interface net.spy.memcached.NodeLocator

getServerByIndex

public net.spy.memcached.MemcachedNode getServerByIndex(int k)

getSequence

public java.util.Iterator<net.spy.memcached.MemcachedNode> getSequence(java.lang.String k)

Specified by:
getSequence in interface net.spy.memcached.NodeLocator

getAll

public java.util.Collection<net.spy.memcached.MemcachedNode> getAll()

Specified by:
getAll in interface net.spy.memcached.NodeLocator

getReadonlyCopy

public net.spy.memcached.NodeLocator getReadonlyCopy()

Specified by:
getReadonlyCopy in interface net.spy.memcached.NodeLocator

updateLocator

public void updateLocator(java.util.List<net.spy.memcached.MemcachedNode> nodes)
Specified by:
updateLocator in interface net.spy.memcached.NodeLocator

updateLocator

public void updateLocator(java.util.Collection<net.spy.memcached.MemcachedNode> nodes,
                          Config newconf)

getVBucketIndex

public int getVBucketIndex(java.lang.String key)
Returns a vbucket index for the given key.

Parameters:
key - the key
Returns:
vbucket index

getAlternative

public net.spy.memcached.MemcachedNode getAlternative(java.lang.String k,
                                                      java.util.Collection<net.spy.memcached.MemcachedNode> notMyVbucketNodes)
Method returns the node that is not contained in the specified collection of the failed nodes.

Parameters:
k - the key
notMyVbucketNodes - a collection of the nodes are excluded
Returns:
The first MemcachedNode which meets requirements


Copyright © 2006-2009 Dustin Sallings, 2009-2012 Couchbase, Inc.