java.lang.Object
org.lmdbjava.Txn<T>
- Type Parameters:
T- buffer type
- All Implemented Interfaces:
AutoCloseable
LMDB transaction.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classTransaction must abort, has a child, or is invalid.static final classInvalid reuse of reader locktable slot.static classThe proposed R-W transaction is incompatible with a R-O Env.static classThe proposed transaction is incompatible with its parent transaction.static final classTransaction is not in a READY state.static classThe current transaction has not been reset.static classThe current transaction is not a read-only transaction.static classThe current transaction is not a read-write transaction.static classThe current transaction has already been reset.static enumTransaction states.static final classTransaction has too many dirty pages. -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Aborts this transaction.voidvoidvoidvoidclose()Closes this transaction by aborting if not already committed.voidcommit()Commits this transaction.longgetId()Return the transaction's ID.Obtains this transaction's parent.getState()Return the state of the transaction.booleanWhether this transaction is read-only.key()Fetch the buffer which holds a read-only view of the LMDI allocated memory.voidrenew()Renews a read-only transaction previously released byreset().voidreset()Aborts this read-only transaction and resets the transaction handle so it can be reused upon callingrenew().val()Fetch the buffer which holds a read-only view of the LMDI allocated memory.
-
Method Details
-
abort
public void abort()Aborts this transaction. -
close
public void close()Closes this transaction by aborting if not already committed.Closing the transaction will invoke
BufferProxy.deallocate(java.lang.Object)for each read-only buffer (ie the key and value).- Specified by:
closein interfaceAutoCloseable
-
commit
public void commit()Commits this transaction. -
getId
public long getId()Return the transaction's ID.- Returns:
- A transaction ID, valid if input is an active transaction
-
getParent
Obtains this transaction's parent.- Returns:
- the parent transaction (may be null)
-
isReadOnly
public boolean isReadOnly()Whether this transaction is read-only.- Returns:
- if read-only
-
key
Fetch the buffer which holds a read-only view of the LMDI allocated memory. Any use of this buffer must comply with the standard LMDB C "mdb_get" contract (ie do not modify, do not attempt to release the memory, do not use once the transaction or cursor closes, do not use after a write etc).- Returns:
- the key buffer (never null)
-
renew
public void renew()Renews a read-only transaction previously released byreset(). -
reset
public void reset()Aborts this read-only transaction and resets the transaction handle so it can be reused upon callingrenew(). -
val
Fetch the buffer which holds a read-only view of the LMDI allocated memory. Any use of this buffer must comply with the standard LMDB C "mdb_get" contract (ie do not modify, do not attempt to release the memory, do not use once the transaction or cursor closes, do not use after a write etc).- Returns:
- the value buffer (never null)
-
checkReadOnly
public void checkReadOnly() -
checkReady
public void checkReady() -
checkWritesAllowed
public void checkWritesAllowed() -
getState
Return the state of the transaction.- Returns:
- the state
-