org.apache.cassandra.db.lifecycle

## Class LifecycleTransaction

- java.lang.Object
- - org.apache.cassandra.utils.concurrent.Transactional.AbstractTransactional
  - - org.apache.cassandra.db.lifecycle.LifecycleTransaction

All Implemented Interfaces:
  java.lang.AutoCloseable, Transactional

    public class LifecycleTransaction
    extends Transactional.AbstractTransactional

### Nested Class Summary

Nested Classes
`static class` `LifecycleTransaction.ReaderState`

### Nested classes/interfaces inherited from interface org.apache.cassandra.utils.concurrent.Transactional

`Transactional.AbstractTransactional`

### Field Summary

Fields
`Tracker` `tracker`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `cancel(java.lang.Iterable<SSTableReader> cancels)` remove the readers from the set we're modifying
`void` `cancel(SSTableReader cancel)` remove the reader from the set we're modifying
`void` `checkpoint()` call when a consistent batch of changes is ready to be made atomically visible these will be exposed in the Tracker atomically, or an exception will be thrown; in this case the transaction should be rolled back
`java.lang.Iterable<SSTableReader>` `current()` returns the currently visible readers managed by this transaction
`SSTableReader` `current(SSTableReader reader)` return the current version of the provided reader, whether or not it is visible or staged; i.e.
`java.lang.Throwable` `doAbort(java.lang.Throwable accumulate)` undo all of the changes made by this transaction, resetting the state to its original form
`java.lang.Throwable` `doCommit(java.lang.Throwable accumulate)` point of no return: commit all changes, but leave all readers marked as compacting
`protected java.lang.Throwable` `doPostCleanup(java.lang.Throwable accumulate)` perform an exception-safe post-abort cleanup
`void` `doPrepare()` Do any preparatory work prior to commit.
`boolean` `isObsolete(SSTableReader reader)` indicates if the reader has been marked for obsoletion
`boolean` `isOffline()`
`void` `obsolete(SSTableReader reader)` mark this reader as for obsoletion.
`void` `obsoleteOriginals()` obsolete every file in the original transaction
`static LifecycleTransaction` `offline(OperationType operationType, java.lang.Iterable<SSTableReader> readers)` construct a Transaction for use in an offline operation
`static LifecycleTransaction` `offline(OperationType operationType, SSTableReader reader)` construct a Transaction for use in an offline operation
`SSTableReader` `onlyOne()`
`java.util.Set<SSTableReader>` `originals()` the set of readers guarded by this transaction _in their original instance/state_ call current(SSTableReader) on any reader in this set to get the latest instance
`void` `permitRedundantTransitions()`
`LifecycleTransaction` `split(java.util.Collection<SSTableReader> readers)` remove the provided readers from this Transaction, and return a new Transaction to manage them only permitted to be called if the current Transaction has never been used
`LifecycleTransaction.ReaderState` `state(SSTableReader reader)`
`java.lang.String` `toString()`
`void` `update(SSTableReader reader, boolean original)` update a reader: if !original, this is a reader that is being introduced by this transaction; otherwise it must be in the originals() set, i.e.

### Methods inherited from class org.apache.cassandra.utils.concurrent.Transactional.AbstractTransactional

`abort, abort, close, commit, commit, doPreCleanup, finish, prepareToCommit, state`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### tracker

    public final Tracker tracker

### Method Detail

#### offline

    public static LifecycleTransaction offline(OperationType operationType,
                                               SSTableReader reader)

construct a Transaction for use in an offline operation

#### offline

    public static LifecycleTransaction offline(OperationType operationType,
                                               java.lang.Iterable<SSTableReader> readers)

construct a Transaction for use in an offline operation

#### doPrepare

    public void doPrepare()

Description copied from class: `Transactional.AbstractTransactional`
Do any preparatory work prior to commit. This method should throw any exceptions that can be encountered during the finalization of the behaviour.

Specified by:
  `doPrepare` in class `Transactional.AbstractTransactional`

#### doCommit

    public java.lang.Throwable doCommit(java.lang.Throwable accumulate)

point of no return: commit all changes, but leave all readers marked as compacting

Specified by:
  `doCommit` in class `Transactional.AbstractTransactional`

#### doAbort

    public java.lang.Throwable doAbort(java.lang.Throwable accumulate)

undo all of the changes made by this transaction, resetting the state to its original form

Specified by:
  `doAbort` in class `Transactional.AbstractTransactional`

#### doPostCleanup

    protected java.lang.Throwable doPostCleanup(java.lang.Throwable accumulate)

Description copied from class: `Transactional.AbstractTransactional`
perform an exception-safe post-abort cleanup

Overrides:
  `doPostCleanup` in class `Transactional.AbstractTransactional`

#### isOffline

    public boolean isOffline()

#### permitRedundantTransitions

    public void permitRedundantTransitions()

Overrides:
  `permitRedundantTransitions` in class `Transactional.AbstractTransactional`

#### checkpoint

    public void checkpoint()

call when a consistent batch of changes is ready to be made atomically visible these will be exposed in the Tracker atomically, or an exception will be thrown; in this case the transaction should be rolled back

#### update

    public void update(SSTableReader reader,
                       boolean original)

update a reader: if !original, this is a reader that is being introduced by this transaction; otherwise it must be in the originals() set, i.e. a reader guarded by this transaction

#### obsolete

    public void obsolete(SSTableReader reader)

mark this reader as for obsoletion. this does not actually obsolete the reader until commit() is called, but on checkpoint() the reader will be removed from the live set

#### obsoleteOriginals

    public void obsoleteOriginals()

obsolete every file in the original transaction

#### current

    public java.lang.Iterable<SSTableReader> current()

returns the currently visible readers managed by this transaction

#### originals

    public java.util.Set<SSTableReader> originals()

the set of readers guarded by this transaction _in their original instance/state_ call current(SSTableReader) on any reader in this set to get the latest instance

#### isObsolete

    public boolean isObsolete(SSTableReader reader)

indicates if the reader has been marked for obsoletion

#### current

    public SSTableReader current(SSTableReader reader)

return the current version of the provided reader, whether or not it is visible or staged; i.e. returns the first version present by testing staged, logged and originals in order.

#### cancel

    public void cancel(SSTableReader cancel)

remove the reader from the set we're modifying

#### cancel

    public void cancel(java.lang.Iterable<SSTableReader> cancels)

remove the readers from the set we're modifying

#### split

    public LifecycleTransaction split(java.util.Collection<SSTableReader> readers)

remove the provided readers from this Transaction, and return a new Transaction to manage them only permitted to be called if the current Transaction has never been used

#### onlyOne

    public SSTableReader onlyOne()

#### state

    public LifecycleTransaction.ReaderState state(SSTableReader reader)

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`