voldemort.store
Interface StorageEngine<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 the transforms
All Superinterfaces:
Store<K,V,T>
All Known Implementing Classes:
AbstractStorageEngine, BdbStorageEngine, ConfigurationStorageEngine, FileBackedCachingStorageEngine, InMemoryStorageEngine, MetadataStore, MysqlStorageEngine, PartitionPrefixedBdbStorageEngine, ReadOnlyStorageEngine, SerializingStorageEngine, SlopStorageEngine, ViewStorageEngine

public interface StorageEngine<K,V,T>
extends Store<K,V,T>

A base storage class which is actually responsible for data persistence. This interface implies all the usual responsibilities of a Store implementation, and in addition

  1. The implementation MUST throw an ObsoleteVersionException if the user attempts to put a version which is strictly before an existing version (concurrent is okay)
  2. The implementation MUST increment this version number when the value is stored.
  3. The implementation MUST contain an ID identifying it as part of the cluster
A hash value can be produced for known subtrees of a StorageEngine


Method Summary
 boolean beginBatchModifications()
          A lot of storage engines support efficient methods for performing large number of writes (puts/deletes) against the data source.
 boolean endBatchModifications()
           
 ClosableIterator<Pair<K,Versioned<V>>> entries()
          Get an iterator over pairs of entries in the store.
 ClosableIterator<Pair<K,Versioned<V>>> entries(int partition)
          Get an iterator over pairs of entries in a store's partition.
 boolean isPartitionAware()
          Are partitions persisted in distinct files? In other words is the data stored on disk on a per-partition basis? This is really for the read-only use case in which each partition is stored in a distinct file.
 boolean isPartitionScanSupported()
          Does the storage engine support efficient scanning of a single partition?
 ClosableIterator<K> keys()
          Get an iterator over keys in the store.
 ClosableIterator<K> keys(int partition)
          Get an iterator over keys in the store's partition Note that the iterator need not be threadsafe, and that it must be manually closed after use.
 java.util.List<Versioned<V>> multiVersionPut(K key, java.util.List<Versioned<V>> values)
          Atomically update storage with the list of versioned values for the given key, to improve storage efficiency.
 void truncate()
          Truncate all entries in the store
 
Methods inherited from interface voldemort.store.Store
close, delete, delete, get, get, getAll, getAll, getCapability, getName, getVersions, put, put
 

Method Detail

entries

ClosableIterator<Pair<K,Versioned<V>>> entries()
Get an iterator over pairs of entries in the store. The key is the first element in the pair and the versioned value is the second element. Note that the iterator need not be threadsafe, and that it must be manually closed after use.

Returns:
An iterator over the entries in this StorageEngine.

keys

ClosableIterator<K> keys()
Get an iterator over keys in the store. Note that the iterator need not be threadsafe, and that it must be manually closed after use.

Returns:
An iterator over the keys in this StorageEngine.

entries

ClosableIterator<Pair<K,Versioned<V>>> entries(int partition)
Get an iterator over pairs of entries in a store's partition. The key is the first element in the pair and the versioned value is the second element. Note that the iterator need not be threadsafe, and that it must be manually closed after use.

Parameters:
partition - partition whose entries are to be fetched
Returns:
An iterator over the entries in this StorageEngine.

keys

ClosableIterator<K> keys(int partition)
Get an iterator over keys in the store's partition Note that the iterator need not be threadsafe, and that it must be manually closed after use.

Parameters:
partition - partition whose keys are to be fetched
Returns:
An iterator over the keys in this StorageEngine.

truncate

void truncate()
Truncate all entries in the store


isPartitionAware

boolean isPartitionAware()
Are partitions persisted in distinct files? In other words is the data stored on disk on a per-partition basis? This is really for the read-only use case in which each partition is stored in a distinct file.

Returns:
Boolean indicating if partitions are persisted in distinct files (read-only use case).

isPartitionScanSupported

boolean isPartitionScanSupported()
Does the storage engine support efficient scanning of a single partition?

Returns:
true if the storage engine implements the capability. false otherwise

beginBatchModifications

boolean beginBatchModifications()
A lot of storage engines support efficient methods for performing large number of writes (puts/deletes) against the data source. This method puts the storage engine in this batch write mode

Returns:
true if the storage engine took successful action to switch to 'batch-write' mode

multiVersionPut

java.util.List<Versioned<V>> multiVersionPut(K key,
                                             java.util.List<Versioned<V>> values)
Atomically update storage with the list of versioned values for the given key, to improve storage efficiency.

Parameters:
key - Key to write
values - List of versioned values to be written atomically.
Returns:
list of obsolete versions that were rejected

endBatchModifications

boolean endBatchModifications()
Returns:
true if the storage engine successfully returned to normal mode


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