voldemort.store.serialized
Class SerializingStore<K,V,T>

java.lang.Object
  extended by voldemort.store.serialized.SerializingStore<K,V,T>
Type Parameters:
K - The type of the key being stored
V - The type of the value being stored
T - The type of transform
All Implemented Interfaces:
Store<K,V,T>
Direct Known Subclasses:
SerializingStorageEngine

public class SerializingStore<K,V,T>
extends java.lang.Object
implements Store<K,V,T>

A store that transforms requests to a Store to a Store


Constructor Summary
SerializingStore(Store<ByteArray,byte[],byte[]> store, Serializer<K> keySerializer, Serializer<V> valueSerializer, Serializer<T> transformsSerializer)
           
 
Method Summary
 void close()
          Close the store.
 boolean delete(K key, Version version)
          Delete all entries prior to the given version
 java.util.List<Versioned<V>> get(K key, T transforms)
          Get the value associated with the given key
 java.util.Map<K,java.util.List<Versioned<V>>> getAll(java.lang.Iterable<K> keys, java.util.Map<K,T> 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.
protected  Serializer<K> getKeySerializer()
           
 java.lang.String getName()
           
protected  Serializer<V> getValueSerializer()
           
 java.util.List<Version> getVersions(K key)
           
 void put(K key, Versioned<V> value, T transforms)
          Associate the value with the key and version in this store
static
<K1,V1,T1> SerializingStore<K1,V1,T1>
wrap(Store<ByteArray,byte[],byte[]> s, Serializer<K1> k, Serializer<V1> v, Serializer<T1> t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerializingStore

public SerializingStore(Store<ByteArray,byte[],byte[]> store,
                        Serializer<K> keySerializer,
                        Serializer<V> valueSerializer,
                        Serializer<T> transformsSerializer)
Method Detail

wrap

public static <K1,V1,T1> SerializingStore<K1,V1,T1> wrap(Store<ByteArray,byte[],byte[]> s,
                                                         Serializer<K1> k,
                                                         Serializer<V1> v,
                                                         Serializer<T1> t)

delete

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

Specified by:
delete in interface Store<K,V,T>
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<V>> get(K key,
                                        T transforms)
                                 throws VoldemortException
Description copied from interface: Store
Get the value associated with the given key

Specified by:
get in interface Store<K,V,T>
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<K,java.util.List<Versioned<V>>> getAll(java.lang.Iterable<K> keys,
                                                            java.util.Map<K,T> 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<K,V,T>
Parameters:
keys - The keys to check for.
Returns:
A Map of keys to a list of versioned values.
Throws:
VoldemortException

getName

public java.lang.String getName()
Specified by:
getName in interface Store<K,V,T>
Returns:
The name of the store.

put

public void put(K key,
                Versioned<V> value,
                T 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<K,V,T>
Parameters:
key - The key to use
value - The value to store and its version.
Throws:
VoldemortException

getVersions

public java.util.List<Version> getVersions(K key)
Specified by:
getVersions in interface Store<K,V,T>

close

public void close()
Description copied from interface: Store
Close the store.

Specified by:
close in interface Store<K,V,T>

getValueSerializer

protected Serializer<V> getValueSerializer()

getKeySerializer

protected Serializer<K> getKeySerializer()

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<K,V,T>
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