
public final class OMicroTransaction extends Object implements OBasicTransaction, OTransactionInternal
DELETED_RECORD| Constructor and Description |
|---|
OMicroTransaction(OAbstractPaginatedStorage storage,
ODatabaseDocumentInternal database)
Instantiates a new micro-transaction.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChangedDocument(ODocument document)
Adds the given document to a set of changed documents known to this transaction.
|
void |
addIndexEntry(OIndex<?> index,
String indexName,
OTransactionIndexChanges.OPERATION type,
Object key,
OIdentifiable value)
Adds the transactional index entry in this transaction.
|
void |
begin()
Begins the micro-transaction.
|
void |
commit()
Commits the micro-transaction if it's a top-level micro-transaction.
|
void |
deleteRecord(ORecord record,
ODatabase.OPERATION_MODE mode)
Deletes the given record in this transaction.
|
int |
getClientTransactionId() |
Object |
getCustomData(String name)
Obtains the custom value by its name stored in the context of this transaction.
|
ODatabaseDocumentInternal |
getDatabase()
Access to the database of the transaction
|
int |
getId() |
OTransactionIndexChanges |
getIndexChanges(String indexName)
Obtains the index changes done in the context of this transaction.
|
OTransactionIndexChanges |
getIndexChangesInternal(String indexName)
Does the same thing as
OBasicTransaction.getIndexChanges(String), but handles remote storages in a special way. |
Map<String,OTransactionIndexChanges> |
getIndexOperations()
Extract all the calculated index operations for the current transaction changes, the key of the map is the index name the value
all the changes for the specified index.
|
ORecord |
getRecord(ORID rid)
Resolves a record with the given RID in the context of this transaction.
|
ORecordOperation |
getRecordEntry(ORID currentRid)
Extract a single change from a specified record id.
|
Collection<ORecordOperation> |
getRecordOperations()
Extract all the record operations for the current transaction
|
boolean |
isActive() |
boolean |
isUsingLog()
Retrieve if log is enabled for the transaction
|
void |
rollback()
Rollbacks the micro-transaction if it's a top-level micro-transaction.
|
void |
rollbackAfterFailedCommit()
Rollbacks the micro-transaction after failed commit attempt.
|
ORecord |
saveRecord(ORecord record,
String clusterName,
ODatabase.OPERATION_MODE operationMode,
boolean forceCreation,
ORecordCallback<? extends Number> createdCallback,
ORecordCallback<Integer> updatedCallback)
Saves the given record in this transaction.
|
void |
setCustomData(String name,
Object value)
Sets the custom value by its name stored in the context of this transaction.
|
void |
setDatabase(ODatabaseDocumentInternal database) |
void |
setStatus(OTransaction.TXSTATUS iStatus)
Change the status of the transaction.
|
void |
updateIdentityAfterCommit(ORID oldRID,
ORID rid)
Notify the transaction for the rid change, the changed will be tracked inside the transaction and used for remapping links.
|
void |
updateIdentityAfterRecordCommit(ORID oldRid,
ORID newRid)
Updates the record identity after its successful commit.
|
void |
updateRecordCacheAfterRollback()
Updates the record cache after unsuccessful micro-transaction commit.
|
public OMicroTransaction(OAbstractPaginatedStorage storage, ODatabaseDocumentInternal database)
storage - the micro-transaction's storage.database - the micro-transaction's database.public int getId()
getId in interface OBasicTransactionpublic int getClientTransactionId()
getClientTransactionId in interface OBasicTransactionpublic void updateIdentityAfterCommit(ORID oldRID, ORID rid)
OTransactionInternalupdateIdentityAfterCommit in interface OTransactionInternaloldRID - the id old value.rid - the id new value.public ODatabaseDocumentInternal getDatabase()
OTransactionInternalgetDatabase in interface OTransactionInternalpublic Collection<ORecordOperation> getRecordOperations()
OTransactionInternalgetRecordOperations in interface OTransactionInternalpublic Map<String,OTransactionIndexChanges> getIndexOperations()
OTransactionInternalgetIndexOperations in interface OTransactionInternalpublic void begin()
public void commit()
public void rollback()
public void rollbackAfterFailedCommit()
public void updateIdentityAfterRecordCommit(ORID oldRid, ORID newRid)
public void updateRecordCacheAfterRollback()
public boolean isActive()
isActive in interface OBasicTransactiontrue if this transaction is active, false otherwise.public ORecord saveRecord(ORecord record, String clusterName, ODatabase.OPERATION_MODE operationMode, boolean forceCreation, ORecordCallback<? extends Number> createdCallback, ORecordCallback<Integer> updatedCallback)
OBasicTransactionsaveRecord in interface OBasicTransactionrecord - the record to save.clusterName - record's cluster name.operationMode - the operation mode.forceCreation - the force creation flag, true to force the creation of the record, false to allow
updates.createdCallback - the callback to invoke when the record save operation triggered the creation of the record.updatedCallback - the callback to invoke when the record save operation triggered the update of the record.public void deleteRecord(ORecord record, ODatabase.OPERATION_MODE mode)
OBasicTransactiondeleteRecord in interface OBasicTransactionrecord - the record to delete.mode - the operation mode.public ORecord getRecord(ORID rid)
OBasicTransactiongetRecord in interface OBasicTransactionrid - the record RID.null if no record is found, or OBasicTransaction.DELETED_RECORD if the record was deleted in
this transaction.public OTransactionIndexChanges getIndexChanges(String indexName)
OBasicTransactiongetIndexChanges in interface OBasicTransactionindexName - the index name.null if index is not found.public OTransactionIndexChanges getIndexChangesInternal(String indexName)
OBasicTransactionOBasicTransaction.getIndexChanges(String), but handles remote storages in a special way.getIndexChangesInternal in interface OBasicTransactionindexName - the index name.null if index is not found or storage is remote.public Object getCustomData(String name)
OBasicTransactiongetCustomData in interface OBasicTransactionname - the value name.null if no value found.public void setCustomData(String name, Object value)
OBasicTransactionsetCustomData in interface OBasicTransactionname - the value name.value - the value to store.public void addIndexEntry(OIndex<?> index, String indexName, OTransactionIndexChanges.OPERATION type, Object key, OIdentifiable value)
OBasicTransactionaddIndexEntry in interface OBasicTransactionindex - the index.indexName - the index name.type - the index operation to register.key - the index key.value - the index key value.public void addChangedDocument(ODocument document)
OBasicTransactionaddChangedDocument in interface OBasicTransactiondocument - the document to add.public void setStatus(OTransaction.TXSTATUS iStatus)
OTransactionInternalsetStatus in interface OTransactionInternalpublic boolean isUsingLog()
OTransactionInternalisUsingLog in interface OTransactionInternalpublic ORecordOperation getRecordEntry(ORID currentRid)
OTransactionInternalgetRecordEntry in interface OTransactionInternalcurrentRid - the record id for the change.public void setDatabase(ODatabaseDocumentInternal database)
setDatabase in interface OTransactionInternalCopyright © 2009–2025 OrientDB. All rights reserved.