voldemort.store
Class DelegatingStore<K,V,T>

java.lang.Object
  extended by voldemort.store.AbstractStore<K,V,T>
      extended by voldemort.store.DelegatingStore<K,V,T>
All Implemented Interfaces:
Store<K,V,T>
Direct Known Subclasses:
GzipStore, InconsistencyResolvingStore, InvalidMetadataCheckingStore, LoggingStore, QuotaLimitingStore, RebootstrappingStore, RedirectingStore, RetentionEnforcingStore, StatTrackingStore, VersionIncrementingStore

public class DelegatingStore<K,V,T>
extends AbstractStore<K,V,T>

A Store template that delegates all operations to an inner store. Convenient for decorating a store and overriding only certain methods to add behavior.


Constructor Summary
DelegatingStore(Store<K,V,T> innerStore)
           
 
Method Summary
 void close()
          Close the store.
 boolean delete(CompositeVoldemortRequest<K,V> request)
          Delete all entries prior to the given version
 boolean delete(K key, Version version)
          Delete all entries prior to the given version
 java.util.List<Versioned<V>> get(CompositeVoldemortRequest<K,V> request)
          Get the value associated with the given key
 java.util.List<Versioned<V>> get(K key, T transform)
          Get the value associated with the given key
 java.util.Map<K,java.util.List<Versioned<V>>> getAll(CompositeVoldemortRequest<K,V> request)
          Get the values associated with the given keys and returns them in a Map of keys to a list of versioned values.
 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.
 Store<K,V,T> getInnerStore()
           
 java.util.List<Version> getVersions(K key)
          Get the versions associated with the given key.
 void put(CompositeVoldemortRequest<K,V> request)
          Associate the value with the key and version in this store
 void put(K key, Versioned<V> value, T transform)
          Associate the value with the key and version in this store
 java.lang.String toString()
           
 
Methods inherited from class voldemort.store.AbstractStore
getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DelegatingStore

public DelegatingStore(Store<K,V,T> innerStore)
Method Detail

close

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

Specified by:
close in interface Store<K,V,T>
Overrides:
close in class AbstractStore<K,V,T>
Throws:
VoldemortException - If closing fails.

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>
Overrides:
delete in class AbstractStore<K,V,T>
Parameters:
key - The key to delete
version - The current value of the key
Returns:
True if anything was deleted
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>
Overrides:
getAll in class AbstractStore<K,V,T>
Parameters:
keys - The keys to check for.
Returns:
A Map of keys to a list of versioned values.
Throws:
VoldemortException

get

public java.util.List<Versioned<V>> get(K key,
                                        T transform)
                                 throws VoldemortException
Description copied from interface: Store
Get the value associated with the given key

Specified by:
get in interface Store<K,V,T>
Overrides:
get in class AbstractStore<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

put

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

getInnerStore

public Store<K,V,T> getInnerStore()

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>
Overrides:
getCapability in class AbstractStore<K,V,T>
Parameters:
capability - The capability type to retrieve
Returns:
The given capaiblity

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getVersions

public java.util.List<Version> getVersions(K 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<K,V,T>
Overrides:
getVersions in class AbstractStore<K,V,T>
Parameters:
key - The key to retrieve the versions for
Returns:
List of Versions associated with this key.

get

public java.util.List<Versioned<V>> get(CompositeVoldemortRequest<K,V> request)
                                 throws VoldemortException
Description copied from interface: Store
Get the value associated with the given key

Specified by:
get in interface Store<K,V,T>
Overrides:
get in class AbstractStore<K,V,T>
Parameters:
request - Contains the key to check for and associated transforms
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(CompositeVoldemortRequest<K,V> request)
                                                     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>
Overrides:
getAll in class AbstractStore<K,V,T>
Parameters:
request - Contains the keys to check for.
Returns:
A Map of keys to a list of versioned values.
Throws:
VoldemortException

put

public void put(CompositeVoldemortRequest<K,V> request)
         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>
Overrides:
put in class AbstractStore<K,V,T>
Parameters:
request - Contains the key to use along with the value and version to use.
Throws:
VoldemortException

delete

public boolean delete(CompositeVoldemortRequest<K,V> request)
               throws VoldemortException
Description copied from interface: Store
Delete all entries prior to the given version

Specified by:
delete in interface Store<K,V,T>
Overrides:
delete in class AbstractStore<K,V,T>
Parameters:
request - Contains the key to delete and current version of the key
Returns:
True if anything was deleted
Throws:
VoldemortException


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