voldemort.store.socket
Class SocketStore

java.lang.Object
  extended by voldemort.store.AbstractStore<ByteArray,byte[],byte[]>
      extended by voldemort.store.socket.SocketStore
All Implemented Interfaces:
NonblockingStore, Store<ByteArray,byte[],byte[]>

public class SocketStore
extends AbstractStore<ByteArray,byte[],byte[]>
implements NonblockingStore

The client implementation of a socket store--translates each request into a network operation to be handled by the socket server on the other side.

SocketStore handles both blocking and non-blocking styles of requesting. For non-blocking requests, SocketStore checks out a ClientRequestExecutor instance from the pool and adds an appropriate request to be processed by the NIO thread.


Constructor Summary
SocketStore(java.lang.String storeName, long timeoutMs, SocketDestination dest, ClientRequestExecutorPool pool, RequestRoutingType requestRoutingType)
           
 
Method Summary
 boolean delete(ByteArray key, Version version)
          Delete all entries prior to the given version
 java.util.List<Versioned<byte[]>> get(ByteArray key, byte[] transforms)
          Get the value associated with the given key
 java.util.Map<ByteArray,java.util.List<Versioned<byte[]>>> getAll(java.lang.Iterable<ByteArray> keys, java.util.Map<ByteArray,byte[]> transforms)
          Get the values associated with the given keys and returns them in a Map of keys to a list of versioned values.
 java.lang.Object getCapability(StoreCapabilityType capability)
          Get some capability of the store.
 java.util.List<Version> getVersions(ByteArray key)
          Get the versions associated with the given key.
 void put(ByteArray key, Versioned<byte[]> versioned, byte[] transforms)
          Associate the value with the key and version in this store
 void submitDeleteRequest(ByteArray key, Version version, NonblockingStoreCallback callback, long timeoutMs)
           
 void submitGetAllRequest(java.lang.Iterable<ByteArray> keys, java.util.Map<ByteArray,byte[]> transforms, NonblockingStoreCallback callback, long timeoutMs)
           
 void submitGetRequest(ByteArray key, byte[] transforms, NonblockingStoreCallback callback, long timeoutMs)
           
 void submitGetVersionsRequest(ByteArray key, NonblockingStoreCallback callback, long timeoutMs)
           
 void submitPutRequest(ByteArray key, Versioned<byte[]> value, byte[] transforms, NonblockingStoreCallback callback, long timeoutMs)
           
 
Methods inherited from class voldemort.store.AbstractStore
close, delete, get, getAll, getName, put
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface voldemort.store.nonblockingstore.NonblockingStore
close
 

Constructor Detail

SocketStore

public SocketStore(java.lang.String storeName,
                   long timeoutMs,
                   SocketDestination dest,
                   ClientRequestExecutorPool pool,
                   RequestRoutingType requestRoutingType)
Method Detail

submitDeleteRequest

public void submitDeleteRequest(ByteArray key,
                                Version version,
                                NonblockingStoreCallback callback,
                                long timeoutMs)
Specified by:
submitDeleteRequest in interface NonblockingStore

submitGetRequest

public void submitGetRequest(ByteArray key,
                             byte[] transforms,
                             NonblockingStoreCallback callback,
                             long timeoutMs)
Specified by:
submitGetRequest in interface NonblockingStore

submitGetAllRequest

public void submitGetAllRequest(java.lang.Iterable<ByteArray> keys,
                                java.util.Map<ByteArray,byte[]> transforms,
                                NonblockingStoreCallback callback,
                                long timeoutMs)
Specified by:
submitGetAllRequest in interface NonblockingStore

submitGetVersionsRequest

public void submitGetVersionsRequest(ByteArray key,
                                     NonblockingStoreCallback callback,
                                     long timeoutMs)
Specified by:
submitGetVersionsRequest in interface NonblockingStore

submitPutRequest

public void submitPutRequest(ByteArray key,
                             Versioned<byte[]> value,
                             byte[] transforms,
                             NonblockingStoreCallback callback,
                             long timeoutMs)
Specified by:
submitPutRequest in interface NonblockingStore

delete

public boolean delete(ByteArray key,
                      Version version)
               throws VoldemortException
Description copied from interface: Store
Delete all entries prior to the given version

Specified by:
delete in interface Store<ByteArray,byte[],byte[]>
Overrides:
delete in class AbstractStore<ByteArray,byte[],byte[]>
Parameters:
key - The key to delete
version - The current value of the key
Returns:
True if anything was deleted
Throws:
VoldemortException

get

public java.util.List<Versioned<byte[]>> get(ByteArray key,
                                             byte[] transforms)
                                      throws VoldemortException
Description copied from interface: Store
Get the value associated with the given key

Specified by:
get in interface Store<ByteArray,byte[],byte[]>
Overrides:
get in class AbstractStore<ByteArray,byte[],byte[]>
Parameters:
key - The key to check for
Returns:
The value associated with the key or an empty list if no values are found.
Throws:
VoldemortException

getAll

public java.util.Map<ByteArray,java.util.List<Versioned<byte[]>>> getAll(java.lang.Iterable<ByteArray> keys,
                                                                         java.util.Map<ByteArray,byte[]> transforms)
                                                                  throws VoldemortException
Description copied from interface: Store
Get the values associated with the given keys and returns them in a Map of keys to a list of versioned values. Note that the returned map will only contain entries for the keys which have a value associated with them.

Specified by:
getAll in interface Store<ByteArray,byte[],byte[]>
Overrides:
getAll in class AbstractStore<ByteArray,byte[],byte[]>
Parameters:
keys - The keys to check for.
Returns:
A Map of keys to a list of versioned values.
Throws:
VoldemortException

getVersions

public java.util.List<Version> getVersions(ByteArray key)
Description copied from interface: Store
Get the versions associated with the given key. This is used in a put call to write a new value for this key

Specified by:
getVersions in interface Store<ByteArray,byte[],byte[]>
Overrides:
getVersions in class AbstractStore<ByteArray,byte[],byte[]>
Parameters:
key - The key to retrieve the versions for
Returns:
List of Versions associated with this key.

put

public void put(ByteArray key,
                Versioned<byte[]> versioned,
                byte[] transforms)
         throws VoldemortException
Description copied from interface: Store
Associate the value with the key and version in this store

Specified by:
put in interface Store<ByteArray,byte[],byte[]>
Overrides:
put in class AbstractStore<ByteArray,byte[],byte[]>
Parameters:
key - The key to use
versioned - The value to store and its version.
Throws:
VoldemortException

getCapability

public java.lang.Object getCapability(StoreCapabilityType capability)
Description copied from interface: Store
Get some capability of the store. Examples would be the serializer used, or the routing strategy. This provides a mechanism to verify that the store hierarchy has some set of capabilities without knowing the precise layering.

Specified by:
getCapability in interface Store<ByteArray,byte[],byte[]>
Overrides:
getCapability in class AbstractStore<ByteArray,byte[],byte[]>
Parameters:
capability - The capability type to retrieve
Returns:
The given capaiblity


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