public class DefaultKetamaNodeLocatorConfiguration extends java.lang.Object implements KetamaNodeLocatorConfiguration
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<MemcachedNode,java.lang.String> |
socketAddresses |
Constructor and Description |
---|
DefaultKetamaNodeLocatorConfiguration() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getKeyForNode(MemcachedNode node,
int repetition)
Returns a uniquely identifying key, suitable for hashing by the
KetamaNodeLocator algorithm.
|
int |
getNodeRepetitions()
Returns the number of discrete hashes that should be defined for each node
in the continuum.
|
protected java.lang.String |
getSocketAddressForNode(MemcachedNode node)
Returns the socket address of a given MemcachedNode.
|
protected java.util.Map<MemcachedNode,java.lang.String> socketAddresses
public DefaultKetamaNodeLocatorConfiguration()
protected java.lang.String getSocketAddressForNode(MemcachedNode node)
node
- The node which we're interested inpublic int getNodeRepetitions()
getNodeRepetitions
in interface KetamaNodeLocatorConfiguration
public java.lang.String getKeyForNode(MemcachedNode node, int repetition)
This default implementation uses the socket-address of the MemcachedNode and concatenates it with a hyphen directly against the repetition number for example a key for a particular server's first repetition may look like:
myhost/10.0.2.1-0
for the second repetition
myhost/10.0.2.1-1
for a server where reverse lookups are failing the returned keys may look like
/10.0.2.1-0
and /10.0.2.1-1
getKeyForNode
in interface KetamaNodeLocatorConfiguration
node
- The MemcachedNode to use to form the unique identifierrepetition
- The repetition number for the particular node in question
(0 is the first repetition)Copyright © 2006-2009 Dustin Sallings, 2009-2013 Couchbase, Inc.