TransactionStore.TransactionMap

A map that supports transactions.

Methods
K ceilingKey(K key)
Get the smallest key that is larger than or equal to this key, or null if no such key exists.
K ceilingKey(K key)
Get the smallest key that is larger than or equal to this key, or null if no such key exists.
Parameters:
key - the key (may not be null)
Returns:
the result
void clear()
Clear the map.
void clear()
Clear the map.
boolean containsKey(K key)
Whether the map contains the key.
boolean containsKey(K key)
Whether the map contains the key.
Parameters:
key - the key
Returns:
true if the map contains an entry for this key
Iterator entryIterator(K from, K to)
Iterate over entries.
Iterator entryIterator(K from, K to)
Iterate over entries.
Parameters:
from - the first key to return
to - the last key to return
Returns:
the iterator
K firstKey()
Get the first key.
K firstKey()
Get the first key.
Returns:
the first key, or null if empty
K floorKey(K key)
Get the largest key that is smaller than or equal to this key, or null if no such key exists.
K floorKey(K key)
Get the largest key that is smaller than or equal to this key, or null if no such key exists.
Parameters:
key - the key (may not be null)
Returns:
the result
V get(K key)
Get the value for the given key at the time when this map was opened.
V get(K key)
Get the value for the given key at the time when this map was opened.
Parameters:
key - the key
Returns:
the value or null
V get(K key, long maxLogId)
Get the value for the given key.
V get(K key, long maxLogId)
Get the value for the given key.
Parameters:
key - the key
maxLogId - the maximum log id
Returns:
the value or null
TransactionStore.TransactionMap getInstance(TransactionStore.Transaction transaction, long savepoint)
Get a clone of this map for the given transaction.
TransactionStore.TransactionMap getInstance(TransactionStore.Transaction transaction, long savepoint)
Get a clone of this map for the given transaction.
Parameters:
transaction - the transaction
savepoint - the savepoint
Returns:
the map
DataType getKeyType()
DataType getKeyType()
V getLatest(K key)
Get the most recent value for the given key.
V getLatest(K key)
Get the most recent value for the given key.
Parameters:
key - the key
Returns:
the value or null
TransactionStore.Transaction getTransaction()
TransactionStore.Transaction getTransaction()
TransactionStore.VersionedValue getValue(K key, long maxLog, TransactionStore.VersionedValue data)
Get the versioned value for the given key.
TransactionStore.VersionedValue getValue(K key, long maxLog, TransactionStore.VersionedValue data)
Get the versioned value for the given key.
Parameters:
key - the key
maxLog - the maximum log id of the entry
data - the value stored in the main map
Returns:
the value
K higherKey(K key)
Get the smallest key that is larger than the given key, or null if no such key exists.
K higherKey(K key)
Get the smallest key that is larger than the given key, or null if no such key exists.
Parameters:
key - the key (may not be null)
Returns:
the result
boolean isClosed()
Check whether this map is closed.
boolean isClosed()
Check whether this map is closed.
Returns:
true if closed
boolean isSameTransaction(K key)
Whether the entry for this key was added or removed from this session.
boolean isSameTransaction(K key)
Whether the entry for this key was added or removed from this session.
Parameters:
key - the key
Returns:
true if yes
Iterator keyIterator(K from)
Iterate over keys.
Iterator keyIterator(K from)
Iterate over keys.
Parameters:
from - the first key to return
Returns:
the iterator
Iterator keyIterator(K from, boolean includeUncommitted)
Iterate over keys.
Iterator keyIterator(K from, boolean includeUncommitted)
Iterate over keys.
Parameters:
from - the first key to return
includeUncommitted - whether uncommitted entries should be included
Returns:
the iterator
K lastKey()
Get the last key.
K lastKey()
Get the last key.
Returns:
the last key, or null if empty
K lowerKey(K key)
Get the largest key that is smaller than the given key, or null if no such key exists.
K lowerKey(K key)
Get the largest key that is smaller than the given key, or null if no such key exists.
Parameters:
key - the key (may not be null)
Returns:
the result
V put(K key, V value)
Update the value for the given key.
V put(K key, V value)
Update the value for the given key.

If the row is locked, this method will retry until the row could be updated or until a lock timeout.

Parameters:
key - the key
value - the new value (not null)
Returns:
the old value
Throws:
IllegalStateException - if a lock timeout occurs
V putCommitted(K key, V value)
Update the value for the given key, without adding an undo log entry.
V putCommitted(K key, V value)
Update the value for the given key, without adding an undo log entry.
Parameters:
key - the key
value - the value
Returns:
the old value
K relativeKey(K key, long offset)
Get one of the previous or next keys.
K relativeKey(K key, long offset)
Get one of the previous or next keys. There might be no value available for the returned key.
Parameters:
key - the key (may not be null)
offset - how many keys to skip (-1 for previous, 1 for next)
Returns:
the key
V remove(K key)
Remove an entry.
V remove(K key)
Remove an entry.

If the row is locked, this method will retry until the row could be updated or until a lock timeout.

Parameters:
key - the key
Throws:
IllegalStateException - if a lock timeout occurs
void setSavepoint(long savepoint)
Set the savepoint.
void setSavepoint(long savepoint)
Set the savepoint. Afterwards, reads are based on the specified savepoint.
Parameters:
savepoint - the savepoint
long sizeAsLong()
Get the size of the map as seen by this transaction.
long sizeAsLong()
Get the size of the map as seen by this transaction.
Returns:
the size
long sizeAsLongMax()
Get the size of the raw map.
long sizeAsLongMax()
Get the size of the raw map. This includes uncommitted entries, and transiently removed entries, so it is the maximum number of entries.
Returns:
the maximum size
boolean tryPut(K key, V value)
Try to update the value for the given key.
boolean tryPut(K key, V value)
Try to update the value for the given key.

This will fail if the row is locked by another transaction (that means, if another open transaction changed the row).

Parameters:
key - the key
value - the new value
Returns:
whether the entry could be updated
boolean tryRemove(K key)
Try to remove the value for the given key.
boolean tryRemove(K key)
Try to remove the value for the given key.

This will fail if the row is locked by another transaction (that means, if another open transaction changed the row).

Parameters:
key - the key
Returns:
whether the entry could be removed
boolean trySet(K key, V value, boolean onlyIfUnchanged)
Try to set or remove the value.
boolean trySet(K key, V value, boolean onlyIfUnchanged)
Try to set or remove the value. When updating only unchanged entries, then the value is only changed if it was not changed after opening the map.
Parameters:
key - the key
value - the new value (null to remove the value)
onlyIfUnchanged - only set the value if it was not changed (by this or another transaction) since the map was opened
Returns:
true if the value was set, false if there was a concurrent update
Iterator wrapIterator(Iterator iterator, boolean includeUncommitted)
Iterate over keys.
Iterator wrapIterator(Iterator iterator, boolean includeUncommitted)
Iterate over keys.
Parameters:
iterator - the iterator to wrap
includeUncommitted - whether uncommitted entries should be included
Returns:
the iterator

Fields
static MVMap map
static int mapId
static long readLogId
static TransactionStore.Transaction transaction

map

The map used for writing (the latest version).

Key: key the key of the data. Value: { transactionId, oldVersion, value }


mapId

The map id.

readLogId

If a record was read that was updated by this transaction, and the update occurred before this log id, the older version is read. This is so that changes are not immediately visible, to support statement processing (for example "update test set id = id + 1").

transaction

The transaction which is used for this map.