org.apache.cassandra.db.commitlog

## Class EncryptedSegment

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

    public class EncryptedSegment
    extends FileDirectSegment

Writes encrypted segments to disk. Data is compressed before encrypting to (hopefully) reduce the size of the data into the encryption algorithms. The format of the encrypted commit log is as follows: - standard commit log header (as written by `CommitLogDescriptor.writeHeader(ByteBuffer, CommitLogDescriptor)`) - a series of 'sync segments' that are written every time the commit log is sync()'ed -- a sync section header, see `CommitLogSegment.writeSyncMarker(long, ByteBuffer, int, int, int)` -- total plain text length for this section -- a series of encrypted data blocks, each of which contains: --- the length of the encrypted block (cipher text) --- the length of the unencrypted data (compressed text) --- the encrypted block, which contains: ---- the length of the plain text (raw) data ---- block of compressed data Notes: - "length of the unencrypted data" is different from the length of resulting decrypted buffer as encryption adds padding to the output buffer, and we need to ignore that padding when processing.

### Nested Class Summary

### Nested classes/interfaces inherited from class org.apache.cassandra.db.commitlog.CommitLogSegment

`CommitLogSegment.Allocation, CommitLogSegment.CDCState, CommitLogSegment.CommitLogSegmentFileComparator`

### Field Summary

### Fields inherited from class org.apache.cassandra.db.commitlog.CommitLogSegment

`descriptor, ENTRY_OVERHEAD_SIZE, id, manager`

### Constructor Summary

Constructors
Constructor and Description
`EncryptedSegment(CommitLog commitLog, AbstractCommitLogSegmentManager manager)`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected java.util.Map<java.lang.String,java.lang.String>` `additionalHeaderParameters()` Provide any additional header data that should be stored in the `CommitLogDescriptor`.
`long` `onDiskSize()`

### Methods inherited from class org.apache.cassandra.db.commitlog.FileDirectSegment

`flush, internalClose`

### Methods inherited from class org.apache.cassandra.db.commitlog.CommitLogSegment

`contains, contentSize, coverInMap, dirtyString, getCDCState, getCurrentCommitLogPosition, getDirtyCFIDs, getName, getPath, isStillAllocating, isUnused, markClean, setCDCState, toString, writeSyncMarker`

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

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

### Constructor Detail

#### EncryptedSegment

    public EncryptedSegment(CommitLog commitLog,
                            AbstractCommitLogSegmentManager manager)

### Method Detail

#### additionalHeaderParameters

    protected java.util.Map<java.lang.String,java.lang.String> additionalHeaderParameters()

Description copied from class: `CommitLogSegment`
Provide any additional header data that should be stored in the `CommitLogDescriptor`.

Overrides:
  `additionalHeaderParameters` in class `CommitLogSegment`

#### onDiskSize

    public long onDiskSize()

Specified by:
  `onDiskSize` in class `CommitLogSegment`