Package net.spy.memcached
Class ArrayModNodeLocator
java.lang.Object
net.spy.memcached.ArrayModNodeLocator
- All Implemented Interfaces:
NodeLocator
NodeLocator implementation for dealing with simple array lookups using a
modulus of the hash code and node list length.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionConstruct an ArraymodNodeLocator over the given array of nodes and using the given hash algorithm.private
ArrayModNodeLocator
(MemcachedNode[] n, HashAlgorithm alg) -
Method Summary
Modifier and TypeMethodDescriptiongetAll()
Get all memcached nodes.getPrimary
(String k) Get the primary location for the given key.Create a read-only copy of this NodeLocator.Get an iterator over the sequence of nodes that make up the backup locations for a given key.private int
getServerForKey
(String key) void
updateLocator
(List<MemcachedNode> newNodes) Update locator status.
-
Field Details
-
hashAlg
-
nodes
-
-
Constructor Details
-
ArrayModNodeLocator
Construct an ArraymodNodeLocator over the given array of nodes and using the given hash algorithm.- Parameters:
n
- the array of nodesalg
- the hash algorithm
-
ArrayModNodeLocator
-
-
Method Details
-
getAll
Description copied from interface:NodeLocator
Get all memcached nodes. This is useful for broadcasting messages.- Specified by:
getAll
in interfaceNodeLocator
-
getPrimary
Description copied from interface:NodeLocator
Get the primary location for the given key.- Specified by:
getPrimary
in interfaceNodeLocator
- Parameters:
k
- the object key- Returns:
- the QueueAttachment containing the primary storage for a key
-
getSequence
Description copied from interface:NodeLocator
Get an iterator over the sequence of nodes that make up the backup locations for a given key.- Specified by:
getSequence
in interfaceNodeLocator
- Parameters:
k
- the object key- Returns:
- the sequence of backup nodes.
-
getReadonlyCopy
Description copied from interface:NodeLocator
Create a read-only copy of this NodeLocator.- Specified by:
getReadonlyCopy
in interfaceNodeLocator
-
updateLocator
Description copied from interface:NodeLocator
Update locator status.- Specified by:
updateLocator
in interfaceNodeLocator
- Parameters:
newNodes
- New locator nodes.
-
getServerForKey
-