Class EncryptedSegment
java.lang.Object
org.apache.cassandra.db.commitlog.CommitLogSegment
org.apache.cassandra.db.commitlog.FileDirectSegment
org.apache.cassandra.db.commitlog.EncryptedSegment
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 ClassesNested classes/interfaces inherited from class org.apache.cassandra.db.commitlog.CommitLogSegment
CommitLogSegment.Allocation, CommitLogSegment.Builder, CommitLogSegment.CDCState, CommitLogSegment.CommitLogSegmentFileComparator -
Field Summary
Fields inherited from class org.apache.cassandra.db.commitlog.CommitLogSegment
descriptor, ENTRY_OVERHEAD_SIZE, id, manager -
Constructor Summary
ConstructorsConstructorDescriptionEncryptedSegment(AbstractCommitLogSegmentManager manager, net.openhft.chronicle.core.util.ThrowingFunction<Path, FileChannel, IOException> channelFactory) -
Method Summary
Modifier and TypeMethodDescriptionProvide any additional header data that should be stored in theCommitLogDescriptor.longMethods inherited from class org.apache.cassandra.db.commitlog.FileDirectSegment
flush, internalCloseMethods inherited from class org.apache.cassandra.db.commitlog.CommitLogSegment
contains, contentSize, coverInMap, createBuffer, dirtyString, getCDCFile, getCDCIndexFile, getCDCState, getCurrentCommitLogPosition, getDirtyTableIds, getName, getPath, isStillAllocating, isUnused, markClean, resetReplayLimit, setCDCState, toString, writeCDCIndexFile, writeSyncMarker
-
Constructor Details
-
EncryptedSegment
public EncryptedSegment(AbstractCommitLogSegmentManager manager, net.openhft.chronicle.core.util.ThrowingFunction<Path, FileChannel, IOException> channelFactory)
-
-
Method Details
-
additionalHeaderParameters
Description copied from class:CommitLogSegmentProvide any additional header data that should be stored in theCommitLogDescriptor.- Overrides:
additionalHeaderParametersin classCommitLogSegment
-
onDiskSize
public long onDiskSize()- Specified by:
onDiskSizein classCommitLogSegment
-