Class Transaction

java.lang.Object
dev.frostlake.transaction.Transaction

public class Transaction extends Object
  • Constructor Details

  • Method Details

    • getId

      public long getId()
    • getState

      public TransactionState getState()
    • setState

      public void setState(TransactionState state)
    • getWriteSet

      public TransactionWriteSet getWriteSet()
      This transaction's deferred-apply write set (stays empty unless transaction.deferredApply is on).
    • logStatementForWal

      public void logStatementForWal(String sql, Instant instant)
      Record a mutating statement to be written to the WAL (as part of this transaction) on commit, together with the instant it called "now" — statements of one transaction get DIFFERENT instants, so the log keeps one per statement rather than one per record.
    • getWalStatements

      public List<String> getWalStatements()
      The mutating statements buffered for the WAL, in execution order (empty when the WAL is off).
    • getWalInstants

      public List<Instant> getWalInstants()
      The instants of getWalStatements(), in the same order.
    • registerStreamConsumption

      public void registerStreamConsumption(Stream stream, StreamReadScope scope)
      Register a stream read by a consuming DML in this txn; consumed on commit (scoped to what the read saw — see StreamReadScope), discarded on rollback. A re-read replaces the scope: the latest read saw the most, and both parts of the scope only ever grow within a transaction.
    • isExplicit

      public boolean isExplicit()
      True if started by an explicit BEGIN — statement-end autocommit is suspended until COMMIT/ROLLBACK.
    • setExplicit

      public void setExplicit(boolean explicit)
    • logInsert

      public void logInsert(String tableName, int rowIndex, Row row)
    • logUpdate

      public void logUpdate(String tableName, int rowIndex, Row oldRow, Row newRow)
    • logDelete

      public void logDelete(String tableName, int rowIndex, Row row)
    • getName

      public String getName()
      The transaction's name, as SHOW TRANSACTIONS reports it: the one BEGIN NAME gave it, or the system-generated UUID when it was opened without one.
    • setName

      public void setName(String name)
      Name this transaction — BEGIN NAME <name> / START TRANSACTION NAME <name>.
    • recordTableTouch

      public void recordTableTouch(String tableName)
      Register the PARTITIONS lock a DML touch takes on a table; the first touch wins the cell.
    • getAllTableLocks

      public Map<String,TableLock> getAllTableLocks()
      Every table lock this transaction holds, whichever apply path recorded it.
    • commit

      public void commit()
    • rollback

      public void rollback()
    • getStartTime

      public long getStartTime()
    • getLogCount

      public int getLogCount()
    • createSavepoint

      public void createSavepoint(String name)
    • rollbackToSavepoint

      public void rollbackToSavepoint(String name)
    • releaseSavepoint

      public void releaseSavepoint(String name)