Package org.apache.cassandra.io.compress
Class CompressionMetadata
java.lang.Object
org.apache.cassandra.utils.concurrent.SharedCloseableImpl
org.apache.cassandra.utils.concurrent.WrappedSharedCloseable
org.apache.cassandra.io.compress.CompressionMetadata
- All Implemented Interfaces:
AutoCloseable,SharedCloseable
Holds metadata about compressed file
TODO extract interface ICompressionMetadata which will just provide non-resource properties
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classHolds offset and length of the file chunkstatic class -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCompressionMetadata(File chunksIndexFile, CompressionParams parameters, Memory chunkOffsets, long chunkOffsetsSize, long dataLength, long compressedFileLength) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTo(Ref.IdentityCollection identities) chunkFor(long position) Get a chunk of compressed data (offset, length) corresponding to given positionintlonggetDataOffsetForChunkOffset(long chunkOffset) longintlongReturns the amount of memory in bytes used off heap.static CompressionMetadataMethods inherited from class org.apache.cassandra.utils.concurrent.SharedCloseableImpl
close, close, isCleanedUp
-
Field Details
-
dataLength
public final long dataLength -
compressedFileLength
public final long compressedFileLength -
chunksIndexFile
-
parameters
-
-
Constructor Details
-
CompressionMetadata
public CompressionMetadata(File chunksIndexFile, CompressionParams parameters, Memory chunkOffsets, long chunkOffsetsSize, long dataLength, long compressedFileLength)
-
-
Method Details
-
open
public static CompressionMetadata open(File chunksIndexFile, long compressedLength, boolean hasMaxCompressedSize) -
compressor
-
chunkLength
public int chunkLength() -
maxCompressedLength
public int maxCompressedLength() -
offHeapSize
public long offHeapSize()Returns the amount of memory in bytes used off heap.- Returns:
- the amount of memory in bytes used off heap
-
addTo
- Specified by:
addToin interfaceSharedCloseable- Overrides:
addToin classSharedCloseableImpl
-
chunkFor
Get a chunk of compressed data (offset, length) corresponding to given position- Parameters:
position- Position in the file.- Returns:
- pair of chunk offset and length.
-
getDataOffsetForChunkOffset
public long getDataOffsetForChunkOffset(long chunkOffset) -
getTotalSizeForSections
- Parameters:
sections- Collection of sections in uncompressed file. Should not contain sections that overlap each other.- Returns:
- Total chunk size in bytes for given sections including checksum.
-
getChunksForSections
public CompressionMetadata.Chunk[] getChunksForSections(Collection<SSTableReader.PartitionPositionBounds> sections) - Parameters:
sections- Collection of sections in uncompressed file- Returns:
- Array of chunks which corresponds to given sections of uncompressed file, sorted by chunk offset
-