public class TransactionalMap
extends java.lang.Object
TransactionSession
and instantiate an new Transaction instance.
In the adapter, we retrieve an existing map, extract the session, and instantiate a new TransactionalMap
or TransactionalMap
.Constructor and Description |
---|
TransactionalMap(TransactionSession session,
java.lang.String className,
boolean isDerived)
Calls processColumnFamily with derivedClassName if derived is true, no args otherwise.
|
Modifier and Type | Method and Description |
---|---|
void |
Close() |
boolean |
contains(TransactionId transactionId,
java.lang.Comparable o)
Contains a value object
|
boolean |
containsKey(TransactionId transactionId,
java.lang.Comparable tkey)
Returns true if the collection contains the given key
|
boolean |
containsValue(TransactionId transactionId,
java.lang.Object value)
Returns true if the collection contains the given value object
|
void |
dropColumn() |
java.util.Iterator<?> |
entrySet(TransactionId transactionId)
Obtain iterator over the entrySet.
|
java.util.stream.Stream<?> |
entrySetStream(TransactionId transactionId)
Get a stream of entry set
|
java.lang.Object |
first(TransactionId transactionId)
Return the first element
|
java.lang.Comparable |
firstKey(TransactionId transactionId)
Get the first key
|
java.lang.Object |
get(TransactionId transactionId,
java.lang.Comparable tkey)
Get a value from backing store if not in cache.
|
java.lang.String |
getClassName() |
java.lang.String |
getDBName() |
org.rocksdb.TransactionDB |
getKVStore() |
java.lang.Object |
getMutexObject() |
TransactionSession |
getSession() |
java.lang.Object |
getValue(TransactionId transactionId,
java.lang.Object tkey)
Get a value from backing store if not in cache.
|
java.lang.Object |
getViaBytes(TransactionId transactionId,
byte[] tkey)
Get a value from backing store if not in cache.
|
java.util.Iterator<?> |
headMap(TransactionId transactionId,
java.lang.Comparable tkey) |
java.util.Iterator<?> |
headMapKV(TransactionId transactionId,
java.lang.Comparable tkey) |
java.util.stream.Stream<?> |
headMapKVStream(TransactionId transactionId,
java.lang.Comparable tkey) |
java.util.stream.Stream<?> |
headMapStream(TransactionId transactionId,
java.lang.Comparable tkey) |
java.util.Iterator<?> |
headSet(TransactionId transactionId,
java.lang.Comparable tkey)
Not a real subset, returns Iterator
|
java.util.Iterator<?> |
headSetKV(TransactionId transactionId,
java.lang.Comparable tkey)
Not a real subset, returns Iterator
|
java.util.stream.Stream<?> |
headSetKVStream(TransactionId transactionId,
java.lang.Comparable tkey)
Get a stream of head set
|
java.util.stream.Stream<?> |
headSetStream(TransactionId transactionId,
java.lang.Comparable tkey)
Get a stream of headset
|
boolean |
isEmpty(TransactionId transactionId)
Return boolean value indicating whether the map is empty
|
java.util.Iterator<?> |
iterator(TransactionId transactionId)
Returns iterator
|
java.util.Iterator<?> |
keySet(TransactionId transactionId)
Get a keySet iterator.
|
java.util.stream.Stream<?> |
keySetStream(TransactionId transactionId)
Get a keyset stream
|
java.lang.Object |
last(TransactionId transactionId)
Return the last value in the set
|
java.lang.Comparable |
lastKey(TransactionId transactionId)
Get the last key in the KVStore
|
java.lang.Object |
nearest(TransactionId transactionId,
java.lang.Comparable tkey)
Return the element nearest to given key
|
void |
Open()
Open the files associated with the BTree for the instances of class
|
boolean |
put(TransactionId transactionId,
java.lang.Comparable tkey,
java.lang.Object tvalue)
Put a key/value pair to main cache and pool.
|
boolean |
putViaBytes(TransactionId transactionId,
byte[] tkey,
java.lang.Object tvalue)
Put a key/value pair to main cache and pool.
|
java.lang.Object |
remove(TransactionId transactionId,
java.lang.Comparable tkey)
Remove object from cache and backing store.
|
long |
size(TransactionId transactionId)
Return the number of elements in the backing store
|
java.util.Iterator<?> |
subMap(TransactionId transactionId,
java.lang.Comparable fkey,
java.lang.Comparable tkey) |
java.util.Iterator<?> |
subMapKV(TransactionId transactionId,
java.lang.Comparable fkey,
java.lang.Comparable tkey) |
java.util.stream.Stream<?> |
subMapKVStream(TransactionId transactionId,
java.lang.Comparable fkey,
java.lang.Comparable tkey) |
java.util.stream.Stream<?> |
subMapStream(TransactionId transactionId,
java.lang.Comparable fkey,
java.lang.Comparable tkey) |
java.util.Iterator<?> |
subSet(TransactionId transactionId,
java.lang.Comparable fkey,
java.lang.Comparable tkey)
Not a real subset, returns iterator vs set.
|
java.util.Iterator<?> |
subSetKV(TransactionId transactionId,
java.lang.Comparable fkey,
java.lang.Comparable tkey)
Not a real subset, returns iterator vs set.
|
java.util.stream.Stream<?> |
subSetKVStream(TransactionId transactionId,
java.lang.Comparable fkey,
java.lang.Comparable tkey)
Return a Streamof key/value pairs that delivers the subset of fkey to tkey
|
java.util.stream.Stream<?> |
subSetStream(TransactionId transactionId,
java.lang.Comparable fkey,
java.lang.Comparable tkey)
Return a Stream that delivers the subset of fkey to tkey
|
java.util.Iterator<?> |
tailMap(TransactionId transactionId,
java.lang.Comparable fkey) |
java.util.Iterator<?> |
tailMapKV(TransactionId transactionId,
java.lang.Comparable fkey) |
java.util.stream.Stream<?> |
tailMapKVStream(TransactionId transactionId,
java.lang.Comparable fkey) |
java.util.stream.Stream<?> |
tailMapStream(TransactionId transactionId,
java.lang.Comparable fkey) |
java.util.Iterator<?> |
tailSet(TransactionId transactionId,
java.lang.Comparable fkey)
Not a real subset, returns Iterator
|
java.util.Iterator<?> |
tailSetKV(TransactionId transactionId,
java.lang.Comparable fkey)
Not a real subset, returns Iterator
|
java.util.stream.Stream<?> |
tailSetKVStream(TransactionId transactionId,
java.lang.Comparable fkey)
Return a tail set key/value stream
|
java.util.stream.Stream<?> |
tailSetStream(TransactionId transactionId,
java.lang.Comparable fkey)
Return a tail set stream
|
java.lang.String |
toString() |
public TransactionalMap(TransactionSession session, java.lang.String className, boolean isDerived) throws java.io.IOException, java.lang.IllegalAccessException, org.rocksdb.RocksDBException
session
- The TransactionSession that manages this instanceclassName
- The class name this map represents. Used to form transaction name and derived column family infoisDerived
- true if this is to represent a derived class, such that the column family handle and descriptor can be properly identifiedjava.io.IOException
java.lang.IllegalAccessException
org.rocksdb.RocksDBException
public TransactionSession getSession() throws java.io.IOException
java.io.IOException
public java.lang.String getClassName()
public void Open() throws java.io.IOException
TransactionSetInterface
java.io.IOException
public void Close() throws java.io.IOException
java.io.IOException
public org.rocksdb.TransactionDB getKVStore()
public boolean put(TransactionId transactionId, java.lang.Comparable tkey, java.lang.Object tvalue) throws java.io.IOException
tkey
- The key for the pairtvalue
- The value for the pairjava.io.IOException
- if put to backing store failspublic boolean putViaBytes(TransactionId transactionId, byte[] tkey, java.lang.Object tvalue) throws java.io.IOException
tkey
- The key for the pair, will not be serializedtvalue
- The value for the pairjava.io.IOException
- if put to backing store failspublic java.lang.Object get(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
tkey
- The key for the valuejava.io.IOException
- if get from backing store failspublic java.lang.Object getViaBytes(TransactionId transactionId, byte[] tkey) throws java.io.IOException
tkey
- The key for the valuejava.io.IOException
- if get from backing store failspublic java.lang.Object getValue(TransactionId transactionId, java.lang.Object tkey) throws java.io.IOException
tkey
- The key for the valueMap.Entry
from RockSack iterator Entry derived from Map.Entry for the keyjava.io.IOException
- if get from backing store failspublic long size(TransactionId transactionId) throws java.io.IOException
java.io.IOException
- If backing store retrieval failurepublic java.util.Iterator<?> entrySet(TransactionId transactionId) throws java.io.IOException
java.io.IOException
- if get from backing store failspublic java.util.stream.Stream<?> entrySetStream(TransactionId transactionId) throws java.io.IOException
java.io.IOException
public java.util.Iterator<?> keySet(TransactionId transactionId) throws java.io.IOException
java.io.IOException
- if get from backing store failspublic java.util.stream.Stream<?> keySetStream(TransactionId transactionId) throws java.io.IOException
java.io.IOException
public boolean containsKey(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
tkey
- The key to matchjava.io.IOException
- If backing store failspublic boolean containsValue(TransactionId transactionId, java.lang.Object value) throws java.io.IOException
value
- The value to matchjava.io.IOException
- If backing store failspublic java.lang.Object remove(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
tkey
- The key to matchjava.io.IOException
- If backing store failspublic java.lang.Comparable firstKey(TransactionId transactionId) throws java.io.IOException
java.io.IOException
- If backing store retrieval failurepublic java.lang.Comparable lastKey(TransactionId transactionId) throws java.io.IOException
java.io.IOException
- If backing store retrieval failurepublic java.lang.Object last(TransactionId transactionId) throws java.io.IOException
java.io.IOException
- If backing store retrieval failurepublic java.lang.Object first(TransactionId transactionId) throws java.io.IOException
java.io.IOException
- If backing store retrieval failurepublic java.lang.Object nearest(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
tkey
- the key to sear forjava.io.IOException
public java.util.Iterator<?> headMap(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
tkey
- Strictly less than 'to' this elementjava.io.IOException
- If backing store retrieval failurepublic java.util.stream.Stream<?> headMapStream(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
java.io.IOException
public java.util.Iterator<?> headMapKV(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
tkey
- Strictly less than 'to' this elementjava.io.IOException
- If backing store retrieval failurepublic java.util.stream.Stream<?> headMapKVStream(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
java.io.IOException
public java.util.Iterator<?> tailMap(TransactionId transactionId, java.lang.Comparable fkey) throws java.io.IOException
fkey
- Greater or equal to 'from' elementjava.io.IOException
- If backing store retrieval failurepublic java.util.stream.Stream<?> tailMapStream(TransactionId transactionId, java.lang.Comparable fkey) throws java.io.IOException
java.io.IOException
public java.util.Iterator<?> tailMapKV(TransactionId transactionId, java.lang.Comparable fkey) throws java.io.IOException
fkey
- Greater or equal to 'from' elementjava.io.IOException
- If backing store retrieval failurepublic java.util.stream.Stream<?> tailMapKVStream(TransactionId transactionId, java.lang.Comparable fkey) throws java.io.IOException
java.io.IOException
public java.util.Iterator<?> subMap(TransactionId transactionId, java.lang.Comparable fkey, java.lang.Comparable tkey) throws java.io.IOException
fkey
- 'from' element inclusivetkey
- 'to' element exclusivejava.io.IOException
- If backing store retrieval failurepublic java.util.stream.Stream<?> subMapStream(TransactionId transactionId, java.lang.Comparable fkey, java.lang.Comparable tkey) throws java.io.IOException
java.io.IOException
public java.util.Iterator<?> subMapKV(TransactionId transactionId, java.lang.Comparable fkey, java.lang.Comparable tkey) throws java.io.IOException
fkey
- 'from' element inclusivetkey
- 'to' element exclusivejava.io.IOException
- If backing store retrieval failurepublic java.util.stream.Stream<?> subMapKVStream(TransactionId transactionId, java.lang.Comparable fkey, java.lang.Comparable tkey) throws java.io.IOException
java.io.IOException
public boolean isEmpty(TransactionId transactionId) throws java.io.IOException
java.io.IOException
- If backing store retrieval failurepublic void dropColumn() throws java.io.IOException
java.io.IOException
public java.lang.String getDBName()
public java.lang.Object getMutexObject()
public java.util.Iterator<?> iterator(TransactionId transactionId) throws java.io.IOException
TransactionSetInterface
java.io.IOException
- If we cannot obtain the iteratorpublic boolean contains(TransactionId transactionId, java.lang.Comparable o) throws java.io.IOException
TransactionSetInterface
java.io.IOException
public java.util.Iterator<?> subSet(TransactionId transactionId, java.lang.Comparable fkey, java.lang.Comparable tkey) throws java.io.IOException
fkey
- Return from fkeytkey
- Return from fkey to strictly less than tkeyjava.io.IOException
- If we cannot obtain the iteratorpublic java.util.stream.Stream<?> subSetStream(TransactionId transactionId, java.lang.Comparable fkey, java.lang.Comparable tkey) throws java.io.IOException
fkey
- the from keytkey
- the to keyjava.io.IOException
public java.util.Iterator<?> headSet(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
tkey
- return from head to strictly less than tkeyjava.io.IOException
- If we cannot obtain the iteratorpublic java.util.stream.Stream<?> headSetStream(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
java.io.IOException
public java.util.Iterator<?> tailSet(TransactionId transactionId, java.lang.Comparable fkey) throws java.io.IOException
fkey
- return from value to endjava.io.IOException
- If we cannot obtain the iteratorpublic java.util.stream.Stream<?> tailSetStream(TransactionId transactionId, java.lang.Comparable fkey) throws java.io.IOException
java.io.IOException
public java.util.Iterator<?> subSetKV(TransactionId transactionId, java.lang.Comparable fkey, java.lang.Comparable tkey) throws java.io.IOException
fkey
- Return from fkeytkey
- Return from fkey to strictly less than tkeyjava.io.IOException
- If we cannot obtain the iteratorpublic java.util.stream.Stream<?> subSetKVStream(TransactionId transactionId, java.lang.Comparable fkey, java.lang.Comparable tkey) throws java.io.IOException
fkey
- the from keytkey
- the to keyjava.io.IOException
public java.util.Iterator<?> headSetKV(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
tkey
- return from head to strictly less than tkeyjava.io.IOException
- If we cannot obtain the iteratorpublic java.util.stream.Stream<?> headSetKVStream(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
java.io.IOException
public java.util.Iterator<?> tailSetKV(TransactionId transactionId, java.lang.Comparable fkey) throws java.io.IOException
fkey
- return from value to endjava.io.IOException
- If we cannot obtain the iteratorpublic java.util.stream.Stream<?> tailSetKVStream(TransactionId transactionId, java.lang.Comparable fkey) throws java.io.IOException
fkey
- from key of tailsetjava.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object