|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvoldemort.client.LazyStoreClient<K,V>
public class LazyStoreClient<K,V>
A StoreClient with lazy initialization. This is useful existing codes
that initializes clients at service deployment time, when the servers may or
may not be available
| Constructor Summary | |
|---|---|
LazyStoreClient(java.util.concurrent.Callable<StoreClient<K,V>> storeClientThunk)
|
|
LazyStoreClient(java.util.concurrent.Callable<StoreClient<K,V>> storeClientThunk,
boolean instantInit)
A Hybrid store client which tries to do immediate bootstrap. |
|
| 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. |
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. |
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 |
java.util.List<Node> |
getResponsibleNodes(K key)
Returns the list of nodes which should have this key. |
StoreClient<K,V> |
getStoreClient()
|
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 StoreClient<K,V> |
initStoreClient()
|
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,
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 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LazyStoreClient(java.util.concurrent.Callable<StoreClient<K,V>> storeClientThunk)
public LazyStoreClient(java.util.concurrent.Callable<StoreClient<K,V>> storeClientThunk,
boolean instantInit)
storeClientThunk - The callback invoked for doing the actual
bootstrapinstantInit - A boolean flag when set indicates that we should try
to immediately bootstrap| Method Detail |
|---|
public StoreClient<K,V> getStoreClient()
protected StoreClient<K,V> initStoreClient()
public V getValue(K key)
StoreClient
getValue in interface StoreClient<K,V>key - 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 Versioned<V> get(K key)
StoreClient
get in interface StoreClient<K,V>key - The key for which to fetch the value.
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)
StoreClient
getAll in interface StoreClient<K,V>keys - The keys for which to fetch the values.
public java.util.Map<K,Versioned<V>> getAll(java.lang.Iterable<K> keys,
java.util.Map<K,java.lang.Object> transforms)
StoreClientgetAll, 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 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 Version put(K key,
V value)
StoreClient
put in interface StoreClient<K,V>key - The keyvalue - The value
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 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 putIfNotObsolete(K key,
Versioned<V> versioned)
StoreClient
putIfNotObsolete in interface StoreClient<K,V>key - The keyversioned - The versioned value
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 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 java.util.List<Node> getResponsibleNodes(K key)
StoreClient
getResponsibleNodes in interface StoreClient<K,V>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||