Interface OTransaction

All Known Subinterfaces:
OTransactionInternal
All Known Implementing Classes:
OTransactionAbstract, OTransactionNoTx, OTransactionOptimistic, OTransactionOptimisticClient, OTransactionOptimisticDistributed, OTransactionOptimisticProxy, OTransactionOptimisticServer

public interface OTransaction
  • Method Details

    • begin

      void begin()
    • commit

      void commit()
    • commit

      void commit(boolean force)
    • rollback

      void rollback()
    • getIsolationLevel

      OTransaction.ISOLATION_LEVEL getIsolationLevel()
      Returns the current isolation level.
    • setIsolationLevel

      OTransaction setIsolationLevel(OTransaction.ISOLATION_LEVEL iIsolationLevel)
      Changes the isolation level. Default is READ_COMMITTED. When REPEATABLE_READ is set, any record read from the storage is cached in memory to guarantee the repeatable reads. This affects the used RAM and speed (because JVM Garbage Collector job).
      Parameters:
      iIsolationLevel - Isolation level to set
      Returns:
      Current object to allow call in chain
    • rollback

      void rollback(boolean force, int commitLevelDiff)
    • getDatabase

      ODatabaseDocument getDatabase()
    • loadRecord

      ORecord loadRecord(ORID iRid, ORecord iRecord, String iFetchPlan, boolean ignoreCache)
    • reloadRecord

      ORecord reloadRecord(ORID iRid, ORecord iRecord, String iFetchPlan, boolean ignoreCache)
    • reloadRecord

      ORecord reloadRecord(ORID iRid, ORecord iRecord, String iFetchPlan, boolean ignoreCache, boolean force)
    • loadRecordIfVersionIsNotLatest

      ORecord loadRecordIfVersionIsNotLatest(ORID rid, int recordVersion, String fetchPlan, boolean ignoreCache) throws ORecordNotFoundException
      Throws:
      ORecordNotFoundException
    • getStatus

    • getRecordOperations

      Iterable<? extends ORecordOperation> getRecordOperations()
    • getNewRecordEntriesByClass

      List<ORecordOperation> getNewRecordEntriesByClass(OClass iClass, boolean iPolymorphic)
    • getNewRecordEntriesByClusterIds

      List<ORecordOperation> getNewRecordEntriesByClusterIds(int[] iIds)
    • getRecordEntry

      ORecordOperation getRecordEntry(ORID rid)
    • getInvolvedIndexes

      List<String> getInvolvedIndexes()
    • getIndexChanges

      ODocument getIndexChanges()
    • close

      void close()
    • updateIdentityAfterCommit

      void updateIdentityAfterCommit(ORID oldRid, ORID newRid)
      When commit in transaction is performed all new records will change their identity, but index values will contain stale links, to fix them given method will be called for each entry. This update local transaction maps too.
      Parameters:
      oldRid - Record identity before commit.
      newRid - Record identity after commit.
    • amountOfNestedTxs

      int amountOfNestedTxs()
    • isLockedRecord

      boolean isLockedRecord(OIdentifiable iRecord)
    • lockingStrategy

      Deprecated.
    • lockRecord

      @Deprecated OTransaction lockRecord(OIdentifiable iRecord, OStorage.LOCKING_STRATEGY iLockingStrategy)
      Deprecated.
    • unlockRecord

      @Deprecated OTransaction unlockRecord(OIdentifiable iRecord)
      Deprecated.
    • getEntryCount

      int getEntryCount()
    • isActive

      boolean isActive()
      Returns:
      true if this transaction is active, false otherwise.
    • saveRecord

      ORecord saveRecord(ORecord record, String clusterName, boolean forceCreate)
      Saves the given record in this transaction.
      Parameters:
      record - the record to save.
      clusterName - record's cluster name.
      forceCreate - the force creation flag, true to force the creation of the record, false to allow updates.
      Returns:
      the record saved.
    • deleteRecord

      void deleteRecord(ORecord record)
      Deletes the given record in this transaction.
      Parameters:
      record - the record to delete.
    • getRecord

      ORecord getRecord(ORID rid)
      Resolves a record with the given RID in the context of this transaction.
      Parameters:
      rid - the record RID.
      Returns:
      the resolved record, or null if no record is found, or OTransactionAbstract.DELETED_RECORD if the record was deleted in this transaction.
    • addIndexEntry

      void addIndexEntry(OIndex index, String indexName, OTransactionIndexChanges.OPERATION operation, Object key, OIdentifiable value)
      Adds the transactional index entry in this transaction.
      Parameters:
      index - the index.
      indexName - the index name.
      operation - the index operation to register.
      key - the index key.
      value - the index key value.
    • addChangedDocument

      void addChangedDocument(ODocument document)
      Adds the given document to a set of changed documents known to this transaction.
      Parameters:
      document - the document to add.
    • getIndexChanges

      OTransactionIndexChanges getIndexChanges(String indexName)
      Obtains the index changes done in the context of this transaction.
      Parameters:
      indexName - the index name.
      Returns:
      the index changes in question or null if index is not found.
    • getIndexChangesInternal

      OTransactionIndexChanges getIndexChangesInternal(String indexName)
      Does the same thing as getIndexChanges(String), but handles remote storages in a special way.
      Parameters:
      indexName - the index name.
      Returns:
      the index changes in question or null if index is not found or storage is remote.
    • getCustomData

      Object getCustomData(String name)
      Obtains the custom value by its name stored in the context of this transaction.
      Parameters:
      name - the value name.
      Returns:
      the obtained value or null if no value found.
    • setCustomData

      void setCustomData(String name, Object value)
      Sets the custom value by its name stored in the context of this transaction.
      Parameters:
      name - the value name.
      value - the value to store.
    • getClientTransactionId

      default int getClientTransactionId()
      Returns:
      this transaction ID as seen by the client of this transaction.
    • getId

      int getId()