voldemort.rest.coordinator
Class DynamicTimeoutStoreClient<K,V>

java.lang.Object
  extended by voldemort.client.DefaultStoreClient<K,V>
      extended by voldemort.rest.coordinator.DynamicTimeoutStoreClient<K,V>
Type Parameters:
K - Type of the Key
V - Type of the Value
All Implemented Interfaces:
StoreClient<K,V>

public class DynamicTimeoutStoreClient<K,V>
extends DefaultStoreClient<K,V>

A special store client to invoke Voldemort operations with the following new features: 1) Per call timeout facility 2) Ability to disable resolution per call TODO: Merge this with DefaultStoreClient eventually.


Field Summary
 
Fields inherited from class voldemort.client.DefaultStoreClient
beforeRebootstrapCallback, metadataRefreshAttempts, resolver, store, storeFactory, storeName
 
Constructor Summary
DynamicTimeoutStoreClient(Store<K,V,java.lang.Object> customStore)
          Dummy constructor for Unit test purposes
DynamicTimeoutStoreClient(java.lang.String storeName, StoreClientFactory storeFactory, int maxMetadataRefreshAttempts, java.lang.String storesXml, java.lang.String clusterXml)
           
 
Method Summary
 void bootStrap(java.lang.String customClusterXml, java.lang.String customStoresXml)
           
 boolean deleteWithCustomTimeout(CompositeVoldemortRequest<K,V> deleteRequestObject)
          Performs a delete operation with the specified composite request object
 java.util.Map<K,java.util.List<Versioned<V>>> getAllWithCustomTimeout(CompositeVoldemortRequest<K,V> requestWrapper)
          Performs a get all operation with the specified composite request object
protected  java.lang.String getKeysHexString(java.lang.Iterable<ByteArray> keys)
           
 java.lang.String getStoreName()
           
 java.util.List<Versioned<V>> getWithCustomTimeout(CompositeVoldemortRequest<K,V> requestWrapper)
          Performs a get operation with the specified composite request object
 Version putVersionedWithCustomTimeout(CompositeVoldemortRequest<K,V> requestWrapper)
          Performs a Versioned put operation with the specified composite request object
 Version putWithCustomTimeout(CompositeVoldemortRequest<K,V> requestWrapper)
          Performs a put operation with the specified composite request object
 
Methods inherited from class voldemort.client.DefaultStoreClient
applyUpdate, applyUpdate, bootStrap, delete, delete, get, get, get, get, getAll, getAll, getItemOrThrow, getResponsibleNodes, getValue, getValue, getVersion, getVersions, put, put, put, put, putIfNotObsolete, setBeforeRebootstrapCallback
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicTimeoutStoreClient

public DynamicTimeoutStoreClient(java.lang.String storeName,
                                 StoreClientFactory storeFactory,
                                 int maxMetadataRefreshAttempts,
                                 java.lang.String storesXml,
                                 java.lang.String clusterXml)
Parameters:
storeName - Name of the store this client connects to
storeFactory - Reference to the factory used to create this client
maxMetadataRefreshAttempts - Number of retries to retrieve the state
storesXml - The storesXml used during bootstrap
clusterXml - The clusterXml used during bootstrap

DynamicTimeoutStoreClient

public DynamicTimeoutStoreClient(Store<K,V,java.lang.Object> customStore)
Dummy constructor for Unit test purposes

Parameters:
customStore - A custom store object to use for performing the operations
Method Detail

bootStrap

public void bootStrap(java.lang.String customClusterXml,
                      java.lang.String customStoresXml)

getWithCustomTimeout

public java.util.List<Versioned<V>> getWithCustomTimeout(CompositeVoldemortRequest<K,V> requestWrapper)
Performs a get operation with the specified composite request object

Parameters:
requestWrapper - A composite request object containing the key (and / or default value) and timeout.
Returns:
The Versioned value corresponding to the key

putWithCustomTimeout

public Version putWithCustomTimeout(CompositeVoldemortRequest<K,V> requestWrapper)
Performs a put operation with the specified composite request object

Parameters:
requestWrapper - A composite request object containing the key and value
Returns:
Version of the value for the successful put

putVersionedWithCustomTimeout

public Version putVersionedWithCustomTimeout(CompositeVoldemortRequest<K,V> requestWrapper)
                                      throws ObsoleteVersionException
Performs a Versioned put operation with the specified composite request object

Parameters:
requestWrapper - Composite request object containing the key and the versioned object
Returns:
Version of the value for the successful put
Throws:
ObsoleteVersionException

getAllWithCustomTimeout

public java.util.Map<K,java.util.List<Versioned<V>>> getAllWithCustomTimeout(CompositeVoldemortRequest<K,V> requestWrapper)
Performs a get all operation with the specified composite request object

Parameters:
requestWrapper - Composite request object containing a reference to the Iterable keys
Returns:
Map of the keys to the corresponding versioned values

deleteWithCustomTimeout

public boolean deleteWithCustomTimeout(CompositeVoldemortRequest<K,V> deleteRequestObject)
Performs a delete operation with the specified composite request object

Parameters:
deleteRequestObject - Composite request object containing the key to delete
Returns:
true if delete was successful. False otherwise

getStoreName

public java.lang.String getStoreName()

getKeysHexString

protected java.lang.String getKeysHexString(java.lang.Iterable<ByteArray> keys)


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu