voldemort.store.bdb
Class BdbStorageEngine

java.lang.Object
  extended by voldemort.store.bdb.BdbStorageEngine
All Implemented Interfaces:
StorageEngine<ByteArray,byte[],byte[]>, Store<ByteArray,byte[],byte[]>

public class BdbStorageEngine
extends java.lang.Object
implements StorageEngine<ByteArray,byte[],byte[]>

A store that uses BDB for persistence


Constructor Summary
BdbStorageEngine(java.lang.String name, com.sleepycat.je.Environment environment, com.sleepycat.je.Database database, com.sleepycat.je.LockMode readLockMode)
           
BdbStorageEngine(java.lang.String name, com.sleepycat.je.Environment environment, com.sleepycat.je.Database database, com.sleepycat.je.LockMode readLockMode, boolean cursorPreload)
           
 
Method Summary
 void close()
          Close the store.
 boolean delete(ByteArray key, Version version)
          Delete all entries prior to the given version
 ClosableIterator<Pair<ByteArray,Versioned<byte[]>>> entries()
          Get an iterator over pairs of entries in the store.
 boolean equals(java.lang.Object o)
           
 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.String getBdbStats()
           
 java.lang.Object getCapability(StoreCapabilityType capability)
          Get some capability of the store.
 java.lang.String getName()
           
 com.sleepycat.je.DatabaseStats getStats(boolean setFast)
           
 java.util.List<Version> getVersions(ByteArray key)
           
 int hashCode()
           
 boolean isPartitionAware()
          Is the data persistence aware of partitions? In other words is the data internally stored on a per partition basis or together
 ClosableIterator<ByteArray> keys()
          Get an iterator over keys in the store.
 void put(ByteArray key, Versioned<byte[]> value, byte[] transforms)
          Associate the value with the key and version in this store
 void truncate()
          Truncate all entries in the store
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BdbStorageEngine

public BdbStorageEngine(java.lang.String name,
                        com.sleepycat.je.Environment environment,
                        com.sleepycat.je.Database database,
                        com.sleepycat.je.LockMode readLockMode)

BdbStorageEngine

public BdbStorageEngine(java.lang.String name,
                        com.sleepycat.je.Environment environment,
                        com.sleepycat.je.Database database,
                        com.sleepycat.je.LockMode readLockMode,
                        boolean cursorPreload)
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface Store<ByteArray,byte[],byte[]>
Returns:
The name of the store.

entries

public ClosableIterator<Pair<ByteArray,Versioned<byte[]>>> entries()
Description copied from interface: StorageEngine
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.

Specified by:
entries in interface StorageEngine<ByteArray,byte[],byte[]>
Returns:
An iterator over the entries in this StorageEngine.

keys

public ClosableIterator<ByteArray> keys()
Description copied from interface: StorageEngine
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.

Specified by:
keys in interface StorageEngine<ByteArray,byte[],byte[]>
Returns:
An iterator over the keys in this StorageEngine.

truncate

public void truncate()
Description copied from interface: StorageEngine
Truncate all entries in the store

Specified by:
truncate in interface StorageEngine<ByteArray,byte[],byte[]>

getVersions

public java.util.List<Version> getVersions(ByteArray key)
Specified by:
getVersions in interface Store<ByteArray,byte[],byte[]>

get

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

Specified by:
get in interface Store<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:
PersistenceFailureException

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[]>
Parameters:
keys - The keys to check for.
Returns:
A Map of keys to a list of versioned values.
Throws:
VoldemortException

put

public void put(ByteArray key,
                Versioned<byte[]> value,
                byte[] transforms)
         throws PersistenceFailureException
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[]>
Parameters:
key - The key to use
value - The value to store and its version.
Throws:
PersistenceFailureException

delete

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

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

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[]>
Parameters:
capability - The capability type to retrieve
Returns:
The given capaiblity

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

close

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

Specified by:
close in interface Store<ByteArray,byte[],byte[]>
Throws:
PersistenceFailureException

getStats

public com.sleepycat.je.DatabaseStats getStats(boolean setFast)

getBdbStats

public java.lang.String getBdbStats()

isPartitionAware

public boolean isPartitionAware()
Description copied from interface: StorageEngine
Is the data persistence aware of partitions? In other words is the data internally stored on a per partition basis or together

Specified by:
isPartitionAware in interface StorageEngine<ByteArray,byte[],byte[]>
Returns:
Boolean indicating if the data persistence is partition aware


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao