org.apache.cassandra.db.commitlog

## Class CommitLogSegment

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

Direct Known Subclasses:
  CompressedSegment, MemoryMappedSegment

    public abstract class CommitLogSegment
    extends java.lang.Object

### Nested Class Summary

Nested Classes
`static class` `CommitLogSegment.CommitLogSegmentFileComparator`

### Field Summary

Fields
`CommitLogDescriptor` `descriptor`
`static int` `ENTRY_OVERHEAD_SIZE`
`long` `id`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`boolean` `contains(ReplayPosition context)` Check to see if a certain ReplayPosition is contained by this segment file.
`long` `contentSize()`
`java.lang.String` `dirtyString()`
`ReplayPosition` `getContext()`
`java.util.Collection<java.util.UUID>` `getDirtyCFIDs()`
`java.lang.String` `getName()`
`java.lang.String` `getPath()`
`protected void` `internalClose()` Close the segment file.
`boolean` `isStillAllocating()`
`boolean` `isUnused()`
`void` `markClean(java.util.UUID cfId, ReplayPosition context)` Marks the ColumnFamily specified by cfId as clean for this log segment.
`abstract long` `onDiskSize()`
`java.lang.String` `toString()`
`protected void` `writeSyncMarker(java.nio.ByteBuffer buffer, int offset, int filePos, int nextMarker)`

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

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

### Field Detail

#### ENTRY_OVERHEAD_SIZE

    public static final int ENTRY_OVERHEAD_SIZE

See Also:
  Constant Field Values

#### id

    public final long id

#### descriptor

    public final CommitLogDescriptor descriptor

### Method Detail

#### writeSyncMarker

    protected void writeSyncMarker(java.nio.ByteBuffer buffer,
                                   int offset,
                                   int filePos,
                                   int nextMarker)

#### isStillAllocating

    public boolean isStillAllocating()

#### getContext

    public ReplayPosition getContext()

Returns:
  the current ReplayPosition for this log segment

#### getPath

    public java.lang.String getPath()

Returns:
  the file path to this segment

#### getName

    public java.lang.String getName()

Returns:
  the file name of this segment

#### internalClose

    protected void internalClose()

Close the segment file. Do not call from outside this class, use syncAndClose() instead.

#### markClean

    public void markClean(java.util.UUID cfId,
                          ReplayPosition context)

Marks the ColumnFamily specified by cfId as clean for this log segment. If the given context argument is contained in this file, it will only mark the CF as clean if no newer writes have taken place.

Parameters:
  `cfId` - the column family ID that is now clean
  `context` - the optional clean offset

#### getDirtyCFIDs

    public java.util.Collection<java.util.UUID> getDirtyCFIDs()

Returns:
  a collection of dirty CFIDs for this segment file.

#### isUnused

    public boolean isUnused()

Returns:
  true if this segment is unused and safe to recycle or delete

#### contains

    public boolean contains(ReplayPosition context)

Check to see if a certain ReplayPosition is contained by this segment file.

Parameters:
  `context` - the replay position to be checked
Returns:
  true if the replay position is contained by this segment file.

#### dirtyString

    public java.lang.String dirtyString()

#### onDiskSize

    public abstract long onDiskSize()

#### contentSize

    public long contentSize()

#### toString

    public java.lang.String toString()

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