|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvoldemort.store.AbstractStore<K,V,T>
voldemort.store.AbstractStorageEngine<K,V,T>
voldemort.store.memory.InMemoryStorageEngine<K,V,T>
public class InMemoryStorageEngine<K,V,T>
A simple non-persistent, in-memory store. Useful for unit testing. TODO Rewrite this class using striped locks for more granular locking.
Field Summary | |
---|---|
protected java.util.concurrent.ConcurrentMap<K,java.util.List<Versioned<V>>> |
map
|
Constructor Summary | |
---|---|
InMemoryStorageEngine(java.lang.String name)
|
|
InMemoryStorageEngine(java.lang.String name,
java.util.concurrent.ConcurrentMap<K,java.util.List<Versioned<V>>> map)
|
Method Summary | |
---|---|
boolean |
delete(K key)
|
boolean |
delete(K key,
Version version)
Delete all entries prior to the given version |
void |
deleteAll()
|
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. |
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(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.util.List<Version> |
getVersions(K key)
Get the versions associated with the given key. |
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 |
put(K key,
Versioned<V> value,
T transforms)
Associate the value with the key and version in this store |
java.lang.String |
toString()
|
java.lang.String |
toString(int size)
|
void |
truncate()
Truncate all entries in the store |
Methods inherited from class voldemort.store.AbstractStorageEngine |
---|
beginBatchModifications, endBatchModifications, getAndLock, isPartitionAware, isPartitionScanSupported, putAndUnlock, releaseLock, resolveAndConstructVersionsToPersist |
Methods inherited from class voldemort.store.AbstractStore |
---|
close, delete, get, getAll, getCapability, getName, put |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface voldemort.store.Store |
---|
close, delete, get, getAll, getCapability, getName, put |
Field Detail |
---|
protected final java.util.concurrent.ConcurrentMap<K,java.util.List<Versioned<V>>> map
Constructor Detail |
---|
public InMemoryStorageEngine(java.lang.String name)
public InMemoryStorageEngine(java.lang.String name, java.util.concurrent.ConcurrentMap<K,java.util.List<Versioned<V>>> map)
Method Detail |
---|
public void deleteAll()
public boolean delete(K key)
public boolean delete(K key, Version version)
Store
delete
in interface Store<K,V,T>
delete
in class AbstractStore<K,V,T>
key
- The key to deleteversion
- The current value of the key
public java.util.List<Version> getVersions(K key)
Store
getVersions
in interface Store<K,V,T>
getVersions
in class AbstractStore<K,V,T>
key
- The key to retrieve the versions for
public java.util.List<Versioned<V>> get(K key, T transform) throws VoldemortException
Store
get
in interface Store<K,V,T>
get
in class AbstractStore<K,V,T>
key
- The key to check for
VoldemortException
public java.util.Map<K,java.util.List<Versioned<V>>> getAll(java.lang.Iterable<K> keys, java.util.Map<K,T> transforms) throws VoldemortException
Store
getAll
in interface Store<K,V,T>
getAll
in class AbstractStore<K,V,T>
keys
- The keys to check for.
VoldemortException
public void put(K key, Versioned<V> value, T transforms) throws VoldemortException
Store
put
in interface Store<K,V,T>
put
in class AbstractStore<K,V,T>
key
- The key to usevalue
- The value to store and its version.
VoldemortException
public java.util.List<Versioned<V>> multiVersionPut(K key, java.util.List<Versioned<V>> values)
StorageEngine
multiVersionPut
in interface StorageEngine<K,V,T>
multiVersionPut
in class AbstractStorageEngine<K,V,T>
key
- Key to writevalues
- List of versioned values to be written atomically.
public ClosableIterator<Pair<K,Versioned<V>>> entries()
StorageEngine
entries
in interface StorageEngine<K,V,T>
entries
in class AbstractStorageEngine<K,V,T>
public ClosableIterator<K> keys()
StorageEngine
keys
in interface StorageEngine<K,V,T>
keys
in class AbstractStorageEngine<K,V,T>
public ClosableIterator<Pair<K,Versioned<V>>> entries(int partition)
StorageEngine
entries
in interface StorageEngine<K,V,T>
entries
in class AbstractStorageEngine<K,V,T>
partition
- partition whose entries are to be fetched
public ClosableIterator<K> keys(int partition)
StorageEngine
keys
in interface StorageEngine<K,V,T>
keys
in class AbstractStorageEngine<K,V,T>
partition
- partition whose keys are to be fetched
public void truncate()
StorageEngine
truncate
in interface StorageEngine<K,V,T>
truncate
in class AbstractStorageEngine<K,V,T>
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(int size)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |