|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.mvstore.db.TransactionStore.TransactionMap<K,V>
K
- the key typeV
- the value typepublic static class TransactionStore.TransactionMap<K,V>
A map that supports transactions.
Method Summary | |
---|---|
void |
clear()
Clear the map. |
boolean |
containsKey(K key)
Whether the map contains the key. |
java.util.Iterator<java.util.Map.Entry<K,V>> |
entryIterator(K from)
Iterate over entries. |
K |
firstKey()
Get the first key. |
V |
get(K key)
Get the value for the given key at the time when this map was opened. |
V |
get(K key,
long maxLogId)
Get the value for the given key. |
TransactionStore.TransactionMap<K,V> |
getInstance(TransactionStore.Transaction transaction,
long savepoint)
Get a clone of this map for the given transaction. |
DataType |
getKeyType()
|
V |
getLatest(K key)
Get the most recent value for the given key. |
K |
getLatestCeilingKey(K key)
Get the most recent smallest key that is larger or equal to this key. |
TransactionStore.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,
boolean includeUncommitted)
Iterate over keys. |
K |
lastKey()
Get the last 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. |
K |
relativeKey(K key,
long offset)
Get one of the previous or next keys. |
V |
remove(K key)
Remove an entry. |
void |
setSavepoint(long savepoint)
Set the savepoint. |
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,
boolean onlyIfUnchanged)
Try to set or remove the value. |
java.util.Iterator<K> |
wrapIterator(java.util.Iterator<K> iterator,
boolean includeUncommitted)
Iterate over keys. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public void setSavepoint(long savepoint)
savepoint
- the savepointpublic TransactionStore.TransactionMap<K,V> getInstance(TransactionStore.Transaction transaction, long savepoint)
transaction
- the transactionsavepoint
- the savepoint
public long sizeAsLongMax()
public long sizeAsLong()
public V remove(K key)
If the row is locked, this method will retry until the row could be updated or until a lock timeout.
key
- the key
java.lang.IllegalStateException
- if a lock timeout occurspublic 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.
key
- the keyvalue
- the new value (not null)
java.lang.IllegalStateException
- if a lock timeout occurspublic V putCommitted(K key, V value)
key
- the keyvalue
- the value
public 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 key
public 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 value
public boolean trySet(K key, V value, boolean onlyIfUnchanged)
key
- the keyvalue
- 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
public V get(K key)
key
- the key
public V getLatest(K key)
key
- the key
public boolean containsKey(K key)
key
- the key
public V get(K key, long maxLogId)
key
- the keymaxLogId
- the maximum log id
public boolean isSameTransaction(K key)
key
- the key
public boolean isClosed()
public void clear()
public K firstKey()
public K lastKey()
public K getLatestCeilingKey(K key)
key
- the key (may not be null)
public K higherKey(K key)
key
- the key (may not be null)
public K relativeKey(K key, long offset)
key
- the key (may not be null)offset
- how many keys to skip (-1 for previous, 1 for next)
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 return
public java.util.Iterator<K> keyIterator(K from, boolean includeUncommitted)
from
- the first key to returnincludeUncommitted
- whether uncommitted entries should be
included
public java.util.Iterator<java.util.Map.Entry<K,V>> entryIterator(K from)
from
- the first key to return
public java.util.Iterator<K> wrapIterator(java.util.Iterator<K> iterator, boolean includeUncommitted)
iterator
- the iterator to wrapincludeUncommitted
- whether uncommitted entries should be
included
public TransactionStore.Transaction getTransaction()
public DataType getKeyType()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |