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 byCommitLogDescriptor.writeHeader(ByteBuffer, CommitLogDescriptor)
) - a series of 'sync segments' that are written every time the commit log is sync()'ed -- a sync section header, seeCommitLogSegment.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 Modifier and Type Class Description protected static class
EncryptedSegment.EncryptedSegmentBuilder
-
Nested 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
Constructors Constructor Description EncryptedSegment(AbstractCommitLogSegmentManager manager, net.openhft.chronicle.core.util.ThrowingFunction<java.nio.file.Path,java.nio.channels.FileChannel,java.io.IOException> channelFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Map<java.lang.String,java.lang.String>
additionalHeaderParameters()
Provide any additional header data that should be stored in theCommitLogDescriptor
.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, createBuffer, dirtyString, getCDCFile, getCDCIndexFile, getCDCState, getCurrentCommitLogPosition, getDirtyTableIds, getName, getPath, isStillAllocating, isUnused, markClean, setCDCState, toString, writeCDCIndexFile, writeSyncMarker
-
-
-
-
Constructor Detail
-
EncryptedSegment
public EncryptedSegment(AbstractCommitLogSegmentManager manager, net.openhft.chronicle.core.util.ThrowingFunction<java.nio.file.Path,java.nio.channels.FileChannel,java.io.IOException> channelFactory)
-
-
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 theCommitLogDescriptor
.- Overrides:
additionalHeaderParameters
in classCommitLogSegment
-
onDiskSize
public long onDiskSize()
- Specified by:
onDiskSize
in classCommitLogSegment
-
-