K - the key typeV - the value typepublic class TransactionMap<K,V>
extends java.util.AbstractMap<K,V>
Methods of this class may be changed at any time without notice. If you use this class directly make sure that your application or library requires exactly the same version of MVStore or H2 jar as the version that you use during its development and build.
| Modifier and Type | Field and Description |
|---|---|
MVMap<K,VersionedValue> |
map
The map used for writing (the latest version).
|
| Modifier and Type | Method and Description |
|---|---|
void |
append(K key,
V value)
Appends entry to underlying map.
|
K |
ceilingKey(K key)
Get the smallest key that is larger than or equal to this key,
or null if no such key exists.
|
void |
clear()
Clear the map.
|
boolean |
containsKey(java.lang.Object key)
Whether the map contains the key.
|
java.util.Iterator<java.util.Map.Entry<K,V>> |
entryIterator(K from,
K to)
Iterate over entries.
|
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
K |
firstKey()
Get the first key.
|
K |
floorKey(K key)
Get the largest key that is smaller than or equal to this key,
or null if no such key exists.
|
V |
get(java.lang.Object key)
Get the effective value for the given key.
|
TransactionMap<K,V> |
getInstance(Transaction transaction)
Get a clone of this map for the given transaction.
|
DataType |
getKeyType() |
Transaction |
getTransaction() |
K |
higherKey(K key)
Get the smallest key that is larger than the given key, or null if no
such key exists.
|
boolean |
isClosed()
Check whether this map is closed.
|
boolean |
isSameTransaction(K key)
Whether the entry for this key was added or removed from this
session.
|
java.util.Iterator<K> |
keyIterator(K from)
Iterate over keys.
|
java.util.Iterator<K> |
keyIterator(K from,
K to,
boolean includeUncommitted)
Iterate over keys.
|
K |
lastKey()
Get the last key.
|
V |
lock(K key)
Lock row for the given key.
|
K |
lowerKey(K key)
Get the largest key that is smaller than the given key, or null if no
such key exists.
|
V |
put(K key,
V value)
Update the value for the given key.
|
V |
putCommitted(K key,
V value)
Update the value for the given key, without adding an undo log entry.
|
V |
putIfAbsent(K key,
V value)
Put the value for the given key if entry for this key does not exist.
|
V |
remove(java.lang.Object key)
Remove an entry.
|
int |
size()
Get the number of entries, as a integer.
|
long |
sizeAsLong()
Get the size of the map as seen by this transaction.
|
long |
sizeAsLongMax()
Get the size of the raw map.
|
boolean |
tryPut(K key,
V value)
Try to update the value for the given key.
|
boolean |
tryRemove(K key)
Try to remove the value for the given key.
|
boolean |
trySet(K key,
V value)
Try to set or remove the value.
|
java.util.Iterator<K> |
wrapIterator(java.util.Iterator<K> iterator,
boolean includeUncommitted)
Iterate over keys.
|
public final MVMap<K,VersionedValue> map
Key: key the key of the data. Value: { transactionId, oldVersion, value }
public TransactionMap<K,V> getInstance(Transaction transaction)
transaction - the transactionpublic final int size()
Integer.MAX_VALUE is
returned if there are more than this entries.size in interface java.util.Map<K,V>size in class java.util.AbstractMap<K,V>sizeAsLong()public long sizeAsLongMax()
public long sizeAsLong()
public V remove(java.lang.Object key)
If the row is locked, this method will retry until the row could be updated or until a lock timeout.
public V put(K key, V value)
If the row is locked, this method will retry until the row could be updated or until a lock timeout.
public V putIfAbsent(K key, V value)
key - the keyvalue - the new value (not null)public void append(K key, V value)
key - should be higher in map's order than any existing keyvalue - to be appendedpublic V lock(K key)
If the row is locked, this method will retry until the row could be updated or until a lock timeout.
key - the keyjava.lang.IllegalStateException - if a lock timeout occurspublic V putCommitted(K key, V value)
key - the keyvalue - the valuepublic boolean tryRemove(K key)
This will fail if the row is locked by another transaction (that means, if another open transaction changed the row).
key - the keypublic boolean tryPut(K key, V value)
This will fail if the row is locked by another transaction (that means, if another open transaction changed the row).
key - the keyvalue - the new valuepublic boolean trySet(K key, V value)
key - the keyvalue - the new value (null to remove the value)public V get(java.lang.Object key)
public boolean containsKey(java.lang.Object key)
public boolean isSameTransaction(K key)
key - the keypublic boolean isClosed()
public void clear()
public K firstKey()
public K lastKey()
public K higherKey(K key)
key - the key (may not be null)public K ceilingKey(K key)
key - the key (may not be null)public K floorKey(K key)
key - the key (may not be null)public K lowerKey(K key)
key - the key (may not be null)public java.util.Iterator<K> keyIterator(K from)
from - the first key to returnpublic java.util.Iterator<K> keyIterator(K from, K to, boolean includeUncommitted)
from - the first key to returnto - the last key to return or null if there is no limitincludeUncommitted - whether uncommitted entries should be
includedpublic java.util.Iterator<java.util.Map.Entry<K,V>> entryIterator(K from, K to)
from - the first key to returnto - the last key to returnpublic java.util.Iterator<K> wrapIterator(java.util.Iterator<K> iterator, boolean includeUncommitted)
iterator - the iterator to wrapincludeUncommitted - whether uncommitted entries should be
includedpublic Transaction getTransaction()
public DataType getKeyType()