CommitLogSegmentManager (apache-cassandra API)
Date: 2014-10-21

org.apache.cassandra.db.commitlog

## Class CommitLogSegmentManager

- java.lang.Object
- - org.apache.cassandra.db.commitlog.CommitLogSegmentManager

-     public class CommitLogSegmentManager
      extends java.lang.Object

  Performs eager-creation of commit log segments in a background thread. All the public methods are thread safe.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CommitLogSegmentManager()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.apache.cassandra.db.commitlog.CommitLogSegment.Allocation` | `allocate(Mutation mutation, int size)` Reserve space in the current segment for the provided mutation or, if there isn't space available, create a new segment.
    `void` | `awaitTermination()` Returns when the management thread terminates.
    `long` | `bytesUsed()`
    `void` | `enableReserveSegmentCreation()` Throws a flag that enables the behavior of keeping at least one spare segment available at all times.
    `boolean` | `manages(java.lang.String name)`
    `void` | `resetUnsafe()` Resets all the segments, for testing purposes.
    `void` | `shutdown()` Initiates the shutdown process for the management thread.

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

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

- - ### Constructor Detail

    - #### CommitLogSegmentManager

          public CommitLogSegmentManager()

  - ### Method Detail

    - #### allocate

          public org.apache.cassandra.db.commitlog.CommitLogSegment.Allocation allocate(Mutation mutation,
                                                                               int size)

      Reserve space in the current segment for the provided mutation or, if there isn't space available, create a new segment.
      Returns:
        the provided Allocation object

    - #### bytesUsed

          public long bytesUsed()

      Returns:
        the space (in bytes) used by all segment files.

    - #### manages

          public boolean manages(java.lang.String name)

      Parameters:
        `name` - the filename to check
      Returns:
        true if file is managed by this manager.

    - #### enableReserveSegmentCreation

          public void enableReserveSegmentCreation()

      Throws a flag that enables the behavior of keeping at least one spare segment available at all times.

    - #### resetUnsafe

          public void resetUnsafe()

      Resets all the segments, for testing purposes. DO NOT USE THIS OUTSIDE OF TESTS.

    - #### shutdown

          public void shutdown()

      Initiates the shutdown process for the management thread.

    - #### awaitTermination

          public void awaitTermination()
                                throws java.lang.InterruptedException

      Returns when the management thread terminates.
      Throws:
        `java.lang.InterruptedException`

Copyright © 2014 The Apache Software Foundation