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()
Close the seesion
|
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()
Drop the column encapsulated by this session
|
java.util.Iterator<?> |
entrySet(TransactionId transactionId)
Obtain iterator over the entrySet.
|
java.util.stream.Stream<?> |
entrySetStream(TransactionId transactionId)
Return the stream over the 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() |
java.lang.Object |
getForUpdate(TransactionId transactionId,
java.lang.Comparable o,
boolean exclusive)
Read a key and make the key value a precondition for commit.
|
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)
Return iterator over headmap
|
java.util.stream.Stream<?> |
headMapKVStream(TransactionId transactionId,
java.lang.Comparable tkey) |
java.util.stream.Stream<?> |
headMapStream(TransactionId transactionId,
java.lang.Comparable tkey)
Return the stream over the headmap.
|
java.util.Iterator<?> |
headSet(TransactionId transactionId,
java.lang.Comparable tkey)
Return iterator over headset
|
java.util.Iterator<?> |
headSetKV(TransactionId transactionId,
java.lang.Comparable tkey)
Return Iterator over headset
|
java.util.stream.Stream<?> |
headSetKVStream(TransactionId transactionId,
java.lang.Comparable tkey)
Return stream over headset
|
java.util.stream.Stream<?> |
headSetStream(TransactionId transactionId,
java.lang.Comparable tkey)
Return stream over 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)
Return the stream over the keyset
|
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 backing store.
|
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)
Tailmap from starting element to end exclusive
|
java.util.Iterator<?> |
tailMapKV(TransactionId transactionId,
java.lang.Comparable fkey) |
java.util.stream.Stream<?> |
tailMapKVStream(TransactionId transactionId,
java.lang.Comparable fkey)
Tailmap from starting element to end exclusive
|
java.util.stream.Stream<?> |
tailMapStream(TransactionId transactionId,
java.lang.Comparable fkey)
Tailmap from starting element to end exclusive
|
java.util.Iterator<?> |
tailSet(TransactionId transactionId,
java.lang.Comparable fkey)
Tailset from starting element to end exclusive
|
java.util.Iterator<?> |
tailSetKV(TransactionId transactionId,
java.lang.Comparable fkey)
Tailset from starting element to end exclusive
|
java.util.stream.Stream<?> |
tailSetKVStream(TransactionId transactionId,
java.lang.Comparable fkey)
Tailset from starting element to end exclusive
|
java.util.stream.Stream<?> |
tailSetStream(TransactionId transactionId,
java.lang.Comparable fkey)
Tailset from starting element to end exclusive
|
java.lang.String |
toString() |
void |
undoGetForUpdate(TransactionId transactionId,
java.lang.Comparable o)
Tell the transaction that it no longer needs to do any conflict checking for this key.
|
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
TransactionSetInterface
java.io.IOException
public boolean put(TransactionId transactionId, java.lang.Comparable tkey, java.lang.Object tvalue) throws java.io.IOException
transactionId
- Transaction Idtkey
- 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
transactionId
- Transaction Idtkey
- 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
transactionId
- Transaction Idtkey
- 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
transactionId
- Transaction Idtkey
- 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
transactionId
- Transaction Idtkey
- 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 java.lang.Object getForUpdate(TransactionId transactionId, java.lang.Comparable o, boolean exclusive) throws java.io.IOException
transactionId
- Transaction Ido
- key to getexclusive
- true to get exclusive accessjava.io.IOException
public void undoGetForUpdate(TransactionId transactionId, java.lang.Comparable o) throws java.io.IOException
transactionId
- Transaction Ido
- key to undojava.io.IOException
public long size(TransactionId transactionId) throws java.io.IOException
transactionId
- Transaction Idjava.io.IOException
- If backing store retrieval failurepublic java.util.Iterator<?> entrySet(TransactionId transactionId) throws java.io.IOException
transactionId
- Transaction Idjava.io.IOException
- if get from backing store failspublic java.util.stream.Stream<?> entrySetStream(TransactionId transactionId) throws java.io.IOException
transactionId
- Transaction Idjava.io.IOException
public java.util.Iterator<?> keySet(TransactionId transactionId) throws java.io.IOException
transactionId
- Transaction Idjava.io.IOException
- if get from backing store failspublic java.util.stream.Stream<?> keySetStream(TransactionId transactionId) throws java.io.IOException
transactionId
- Transaction Idjava.io.IOException
public boolean containsKey(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
transactionId
- Transaction Idtkey
- The key to matchjava.io.IOException
- If backing store failspublic boolean containsValue(TransactionId transactionId, java.lang.Object value) throws java.io.IOException
transactionId
- Transaction Idvalue
- The value to matchjava.io.IOException
- If backing store failspublic java.lang.Object remove(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
transactionId
- Transaction Idtkey
- The key to matchjava.io.IOException
- If backing store failspublic java.lang.Comparable firstKey(TransactionId transactionId) throws java.io.IOException
transactionId
- Transaction Idjava.io.IOException
- If backing store retrieval failurepublic java.lang.Comparable lastKey(TransactionId transactionId) throws java.io.IOException
transactionId
- Transaction Idjava.io.IOException
- If backing store retrieval failurepublic java.lang.Object last(TransactionId transactionId) throws java.io.IOException
transactionId
- Transaction Idjava.io.IOException
- If backing store retrieval failurepublic java.lang.Object first(TransactionId transactionId) throws java.io.IOException
transactionId
- Transaction Idjava.io.IOException
- If backing store retrieval failurepublic java.lang.Object nearest(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
transactionId
- Transaction Idtkey
- the key to search forjava.io.IOException
public java.util.Iterator<?> headMap(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
transactionId
- Transaction Idtkey
- 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
transactionId
- Transaction Idtkey
- 'to' elementjava.io.IOException
public java.util.Iterator<?> headMapKV(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
transactionId
- Transaction Idtkey
- 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
transactionId
- Transaction Idtkey
- Strictly less than 'to' this elementjava.io.IOException
- If backing store retrieval failurepublic java.util.Iterator<?> tailMap(TransactionId transactionId, java.lang.Comparable fkey) throws java.io.IOException
transactionId
- Transaction Idfkey
- 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
transactionId
- Transaction Idfkey
- Greater or equal to 'from' elementjava.io.IOException
- If backing store retrieval failurepublic java.util.Iterator<?> tailMapKV(TransactionId transactionId, java.lang.Comparable fkey) throws java.io.IOException
transactionId
- Transaction Idfkey
- 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
transactionId
- Transaction Idfkey
- Greater or equal to 'from' elementjava.io.IOException
- If backing store retrieval failurepublic java.util.Iterator<?> subMap(TransactionId transactionId, java.lang.Comparable fkey, java.lang.Comparable tkey) throws java.io.IOException
transactionId
- Transaction Idfkey
- '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
transactionId
- Transaction Idfkey
- 'from' element inclusivetkey
- 'to' element exclusivejava.io.IOException
- If backing store retrieval failurepublic java.util.Iterator<?> subMapKV(TransactionId transactionId, java.lang.Comparable fkey, java.lang.Comparable tkey) throws java.io.IOException
transactionId
- Transaction Idfkey
- '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
transactionId
- Transaction Idfkey
- 'from' element inclusivetkey
- 'to' element exclusivejava.io.IOException
- If backing store retrieval failurepublic boolean isEmpty(TransactionId transactionId) throws java.io.IOException
transactionId
- Transaction Idjava.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
transactionId
- Transaction Idjava.io.IOException
- If we cannot obtain the iteratorpublic boolean contains(TransactionId transactionId, java.lang.Comparable o) throws java.io.IOException
TransactionSetInterface
transactionId
- Transaction Ido
- the object in questionjava.io.IOException
public java.util.Iterator<?> subSet(TransactionId transactionId, java.lang.Comparable fkey, java.lang.Comparable tkey) throws java.io.IOException
transactionId
- Transaction Idfkey
- 'from' element inclusivetkey
- 'to' element exclusivejava.io.IOException
- If backing store retrieval failurepublic java.util.stream.Stream<?> subSetStream(TransactionId transactionId, java.lang.Comparable fkey, java.lang.Comparable tkey) throws java.io.IOException
transactionId
- Transaction Idfkey
- 'from' element inclusivetkey
- 'to' element exclusivejava.io.IOException
- If backing store retrieval failurepublic java.util.Iterator<?> headSet(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
transactionId
- Transaction Idtkey
- Strictly less than 'to' this elementjava.io.IOException
- If backing store retrieval failurepublic java.util.stream.Stream<?> headSetStream(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
transactionId
- Transaction Idtkey
- Strictly less than 'to' this elementjava.io.IOException
- If backing store retrieval failurepublic java.util.Iterator<?> tailSet(TransactionId transactionId, java.lang.Comparable fkey) throws java.io.IOException
transactionId
- Transaction Idfkey
- Greater or equal to 'from' elementjava.io.IOException
- If backing store retrieval failurepublic java.util.stream.Stream<?> tailSetStream(TransactionId transactionId, java.lang.Comparable fkey) throws java.io.IOException
transactionId
- Transaction Idfkey
- Greater or equal to 'from' elementjava.io.IOException
- If backing store retrieval failurepublic java.util.Iterator<?> subSetKV(TransactionId transactionId, java.lang.Comparable fkey, java.lang.Comparable tkey) throws java.io.IOException
transactionId
- Transaction Idfkey
- 'from' element inclusivetkey
- 'to' element exclusivejava.io.IOException
- If backing store retrieval failurepublic java.util.stream.Stream<?> subSetKVStream(TransactionId transactionId, java.lang.Comparable fkey, java.lang.Comparable tkey) throws java.io.IOException
transactionId
- Transaction Idfkey
- 'from' element inclusivetkey
- 'to' element exclusivejava.io.IOException
- If backing store retrieval failurepublic java.util.Iterator<?> headSetKV(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
transactionId
- Transaction Idtkey
- Strictly less than 'to' this elementKeyValue
java.io.IOException
- If backing store retrieval failurepublic java.util.stream.Stream<?> headSetKVStream(TransactionId transactionId, java.lang.Comparable tkey) throws java.io.IOException
transactionId
- Transaction Idtkey
- Strictly less than 'to' this elementjava.io.IOException
- If backing store retrieval failurepublic java.util.Iterator<?> tailSetKV(TransactionId transactionId, java.lang.Comparable fkey) throws java.io.IOException
transactionId
- Transaction Idfkey
- Greater or equal to 'from' elementjava.io.IOException
- If backing store retrieval failurepublic java.util.stream.Stream<?> tailSetKVStream(TransactionId transactionId, java.lang.Comparable fkey) throws java.io.IOException
transactionId
- Transaction Idfkey
- Greater or equal to 'from' elementjava.io.IOException
- If backing store retrieval failurepublic java.lang.String toString()
toString
in class java.lang.Object