public class SnapshotJTransaction extends JTransaction implements Closeable
JTransactionthat persists indefinitely.
The purpose of
SnapshotJTransactions is to hold a "snapshot" some portion of the state of a parent
for later use after the parent transaction closes. Each
SnapshotJTransaction contains its own set of "snapshot"
JObjects that are (usually) copies of the corresponding "real" database
has the same schema as its parent
SnapshotJTransactions live indefinitely, their objects can be used just like normal Java objects,
outside of any regular transaction, yet all of the usual
Permazen features such as indexing, listeners,
validation, etc., continue to function normally.
More general usage beyond snapshots of regular transactions is possible: an empty
SnapshotJTransaction can be created
on the fly via
JTransaction.createSnapshotTransaction() and then used as simple
in-memory transaction "workspace". The resulting key/value pairs could then be (de)serialized and sent over the network;
see for example
KVDatabase's that support it, using the key/value store snapshot returned by
KVTransaction.mutableSnapshot() allows an efficient "copy" of the entire database into a
|Modifier and Type||Method and Description|
Close this instance and release any resources associated with it.
Commit this transaction.
Determine whether this instance is a
Determine whether this transaction is still valid.
Delete all objects contained in this snapshot transaction and reset it back to its initial state.
Roll back this transaction.
cascadeFindAll, cascadeFindAll, copyTo, copyTo, copyTo, copyTo, create, create, createClones, createSnapshotTransaction, delete, exists, followReferencePath, get, get, get, getAll, getCurrent, getKey, getKey, getPermazen, getSchemaVersion, getSnapshotTransaction, getValidationMode, invertReferencePath, performAction, queryCompositeIndex, queryCompositeIndex, queryCompositeIndex, queryIndex, queryIndex, queryListElementIndex, queryMapValueIndex, queryVersion, readCounterField, readListField, readMapField, readSetField, readSimpleField, recreate, registerJObject, resetValidationQueue, revalidate, setCurrent, updateSchemaVersion, validate, weakConsistency, writeSimpleField
public boolean isSnapshot()
public SnapshotTransaction getTransaction()
SnapshotTransactionassociated with this instance.
public void reset()
It will contain schema meta-data but no objects.
public void commit()
public void rollback()
public boolean isValid()
SnapshotJTransactions are always valid.
public void close()
Copyright © 2022. All rights reserved.