CompressionMetadata.Writer (apache-cassandra API)
Date: 2018-02-14

org.apache.cassandra.io.compress

## Class CompressionMetadata.Writer

- java.lang.Object
- - org.apache.cassandra.utils.concurrent.Transactional.AbstractTransactional
  - - org.apache.cassandra.io.compress.CompressionMetadata.Writer

- All Implemented Interfaces:
    java.lang.AutoCloseable, Transactional
  Enclosing class:
    CompressionMetadata

      public static class CompressionMetadata.Writer
      extends Transactional.AbstractTransactional
      implements Transactional

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.cassandra.utils.concurrent.Transactional.AbstractTransactional

      `Transactional.AbstractTransactional.State`

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

      `Transactional.AbstractTransactional`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addOffset(long offset)`
    `long` | `chunkOffsetBy(int chunkIndex)` Get a chunk offset by it's index.
    `protected java.lang.Throwable` | `doAbort(java.lang.Throwable accumulate)`
    `protected java.lang.Throwable` | `doCommit(java.lang.Throwable accumulate)`
    `protected java.lang.Throwable` | `doPostCleanup(java.lang.Throwable failed)` perform an exception-safe post-abort cleanup
    `void` | `doPrepare()` Do any preparatory work prior to commit.
    `CompressionMetadata.Writer` | `finalizeLength(long dataLength, int chunkCount)`
    `static CompressionMetadata.Writer` | `open(CompressionParams parameters, java.lang.String path)`
    `CompressionMetadata` | `open(long dataLength, long compressedLength)`
    `void` | `resetAndTruncate(int chunkIndex)` Reset the writer so that the next chunk offset written will be the one of `chunkIndex`.

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

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

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

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

    - ### Methods inherited from interface org.apache.cassandra.utils.concurrent.Transactional

      `abort, close, commit, prepareToCommit`

- - ### Method Detail

    - #### open

          public static CompressionMetadata.Writer open(CompressionParams parameters,
                                                        java.lang.String path)

    - #### addOffset

          public void addOffset(long offset)

    - #### finalizeLength

          public CompressionMetadata.Writer finalizeLength(long dataLength,
                                                           int chunkCount)

    - #### 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`

    - #### open

          public CompressionMetadata open(long dataLength,
                                          long compressedLength)

    - #### chunkOffsetBy

          public long chunkOffsetBy(int chunkIndex)

      Get a chunk offset by it's index.
      Parameters:
        `chunkIndex` - Index of the chunk.
      Returns:
        offset of the chunk in the compressed file.

    - #### resetAndTruncate

          public void resetAndTruncate(int chunkIndex)

      Reset the writer so that the next chunk offset written will be the one of `chunkIndex`.
      Parameters:
        `chunkIndex` - the next index to write

    - #### doPostCleanup

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

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

    - #### doCommit

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

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

    - #### doAbort

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

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

Copyright © 2018 The Apache Software Foundation