|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvoldemort.client.DefaultStoreClient<K,V>
K
- The key typeV
- The value typepublic class DefaultStoreClient<K,V>
The default StoreClient
implementation
you get back from a StoreClientFactory
Field Summary | |
---|---|
protected java.util.concurrent.Callable<java.lang.Object> |
beforeRebootstrapCallback
|
protected int |
metadataRefreshAttempts
|
protected InconsistencyResolver<Versioned<V>> |
resolver
|
protected Store<K,V,java.lang.Object> |
store
|
protected StoreClientFactory |
storeFactory
|
protected java.lang.String |
storeName
|
Constructor Summary | |
---|---|
DefaultStoreClient()
|
|
DefaultStoreClient(java.lang.String storeName,
InconsistencyResolver<Versioned<V>> resolver,
StoreClientFactory storeFactory,
int maxMetadataRefreshAttempts)
|
Method Summary | |
---|---|
boolean |
applyUpdate(UpdateAction<K,V> action)
Apply the given action repeatedly until no ObsoleteVersionException is thrown. |
boolean |
applyUpdate(UpdateAction<K,V> action,
int maxTries)
Apply the given action repeatedly until no ObsoleteVersionException is thrown or maxTries unsuccessful attempts have been made. |
void |
bootStrap()
|
boolean |
delete(K key)
Delete any version of the given key which equal to or less than the current versions |
boolean |
delete(K key,
Version version)
Delete the specified version and any prior versions of the given key |
Versioned<V> |
get(K key)
Get the versioned value associated with the given key or null if no value is associated with the key. |
Versioned<V> |
get(K key,
java.lang.Object transforms)
Get the versioned value associated with the given key and apply the given transforms to it before returning the value. |
Versioned<V> |
get(K key,
Versioned<V> defaultValue)
Get the versioned value associated with the given key or the defaultValue if no value is associated with the key. |
Versioned<V> |
get(K key,
Versioned<V> defaultValue,
java.lang.Object transform)
|
java.util.Map<K,Versioned<V>> |
getAll(java.lang.Iterable<K> keys)
Gets the versioned values associated with the given keys and returns them in a Map of keys to versioned values. |
java.util.Map<K,Versioned<V>> |
getAll(java.lang.Iterable<K> keys,
java.util.Map<K,java.lang.Object> transforms)
Like getAll , except
that the transforms are applied on the value associated with each key
before returning the results |
protected Versioned<V> |
getItemOrThrow(K key,
Versioned<V> defaultValue,
java.util.List<Versioned<V>> items)
|
java.util.List<Node> |
getResponsibleNodes(K key)
Returns the list of nodes which should have this key. |
V |
getValue(K key)
Get the value associated with the given key or null if there is no value associated with this key. |
V |
getValue(K key,
V defaultValue)
Get the value associated with the given key or defaultValue if there is no value associated with the key. |
protected Version |
getVersion(K key)
|
protected java.util.List<Version> |
getVersions(K key)
|
Version |
put(K key,
V value)
Associated the given value to the key, clobbering any existing values stored for the key. |
Version |
put(K key,
Versioned<V> versioned)
Put the given Versioned value into the store for the given key if the version is greater to or concurrent with existing values. |
Version |
put(K key,
Versioned<V> versioned,
java.lang.Object transform)
|
Version |
put(K key,
V value,
java.lang.Object transforms)
Like #put(Object, Object) , except
that the given transforms are applied on the value before writing it to
the store |
boolean |
putIfNotObsolete(K key,
Versioned<V> versioned)
Put the versioned value to the key, ignoring any ObsoleteVersionException that may be thrown |
void |
setBeforeRebootstrapCallback(java.util.concurrent.Callable<java.lang.Object> callback)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.concurrent.Callable<java.lang.Object> beforeRebootstrapCallback
protected StoreClientFactory storeFactory
protected int metadataRefreshAttempts
protected java.lang.String storeName
protected InconsistencyResolver<Versioned<V>> resolver
protected volatile Store<K,V,java.lang.Object> store
Constructor Detail |
---|
public DefaultStoreClient(java.lang.String storeName, InconsistencyResolver<Versioned<V>> resolver, StoreClientFactory storeFactory, int maxMetadataRefreshAttempts)
public DefaultStoreClient()
Method Detail |
---|
public void bootStrap()
public boolean delete(K key)
StoreClient
delete
in interface StoreClient<K,V>
key
- The key
public boolean delete(K key, Version version)
StoreClient
delete
in interface StoreClient<K,V>
key
- The key to deleteversion
- The version of the key
public V getValue(K key, V defaultValue)
StoreClient
getValue
in interface StoreClient<K,V>
key
- The key for which to fetch the associated valuedefaultValue
- A value to return if there is no value associated
with this key
public V getValue(K key)
StoreClient
getValue
in interface StoreClient<K,V>
key
- The keypublic Versioned<V> get(K key, Versioned<V> defaultValue)
StoreClient
get
in interface StoreClient<K,V>
key
- The key for which to fetch the value.
public Versioned<V> get(K key, Versioned<V> defaultValue, java.lang.Object transform)
protected java.util.List<Version> getVersions(K key)
protected Versioned<V> getItemOrThrow(K key, Versioned<V> defaultValue, java.util.List<Versioned<V>> items)
public Versioned<V> get(K key)
StoreClient
get
in interface StoreClient<K,V>
key
- The key for which to fetch the value.
public java.util.Map<K,Versioned<V>> getAll(java.lang.Iterable<K> keys)
StoreClient
getAll
in interface StoreClient<K,V>
keys
- The keys for which to fetch the values.
public Version put(K key, V value)
StoreClient
put
in interface StoreClient<K,V>
key
- The keyvalue
- The value
public Version put(K key, Versioned<V> versioned, java.lang.Object transform) throws ObsoleteVersionException
ObsoleteVersionException
public boolean putIfNotObsolete(K key, Versioned<V> versioned)
StoreClient
putIfNotObsolete
in interface StoreClient<K,V>
key
- The keyversioned
- The versioned value
public Version put(K key, Versioned<V> versioned) throws ObsoleteVersionException
StoreClient
put
in interface StoreClient<K,V>
key
- The keyversioned
- The value and its versioned
ObsoleteVersionException
public boolean applyUpdate(UpdateAction<K,V> action)
StoreClient
applyUpdate
in interface StoreClient<K,V>
action
- The action to apply. This is meant as a callback for the
user to extend to provide their own logic.
public boolean applyUpdate(UpdateAction<K,V> action, int maxTries)
StoreClient
applyUpdate
in interface StoreClient<K,V>
action
- The action to apply
public java.util.List<Node> getResponsibleNodes(K key)
StoreClient
getResponsibleNodes
in interface StoreClient<K,V>
protected Version getVersion(K key)
public Versioned<V> get(K key, java.lang.Object transforms)
StoreClient
get
in interface StoreClient<K,V>
key
- the key for which the value is fetchedtransforms
- the transforms to be applied on the value fetched from
the store
public java.util.Map<K,Versioned<V>> getAll(java.lang.Iterable<K> keys, java.util.Map<K,java.lang.Object> transforms)
StoreClient
getAll
, except
that the transforms are applied on the value associated with each key
before returning the results
getAll
in interface StoreClient<K,V>
keys
- the keys for which the values are fetchedtransforms
- the map of transforms, describing the transform to be
applied to the value for each key
public Version put(K key, V value, java.lang.Object transforms)
StoreClient
#put(Object, Object)
, except
that the given transforms are applied on the value before writing it to
the store
put
in interface StoreClient<K,V>
key
- the keyvalue
- the valuetransforms
- the transforms to be applied on the value
public void setBeforeRebootstrapCallback(java.util.concurrent.Callable<java.lang.Object> callback)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |