Package org.apache.cassandra.io.compress
Class CompressionMetadata
- java.lang.Object
-
- org.apache.cassandra.io.compress.CompressionMetadata
-
public class CompressionMetadata extends java.lang.ObjectHolds metadata about compressed file
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCompressionMetadata.ChunkHolds offset and length of the file chunkstatic classCompressionMetadata.Writer
-
Field Summary
Fields Modifier and Type Field Description longcompressedFileLengthlongdataLengthjava.lang.StringindexFilePathCompressionParamsparameters
-
Constructor Summary
Constructors Constructor Description CompressionMetadata(java.lang.String indexFilePath, long compressedLength, boolean hasMaxCompressedSize)CompressionMetadata(java.lang.String filePath, CompressionParams parameters, Memory offsets, long offsetsSize, long dataLength, long compressedLength)CompressionMetadata(Descriptor desc, long compressedLength)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTo(Ref.IdentityCollection identities)CompressionMetadata.ChunkchunkFor(long position)Get a chunk of compressed data (offset, length) corresponding to given positionintchunkLength()voidclose()ICompressorcompressor()static CompressionMetadatacreate(java.lang.String dataFilePath)Create metadata about given compressed file including uncompressed data length, chunk size and list of the chunk offsets of the compressed data.static CompressionMetadatacreateWithLength(java.lang.String dataFilePath, long compressedLength)CompressionMetadata.Chunk[]getChunksForSections(java.util.Collection<SSTableReader.PartitionPositionBounds> sections)longgetTotalSizeForSections(java.util.Collection<SSTableReader.PartitionPositionBounds> sections)intmaxCompressedLength()longoffHeapSize()Returns the amount of memory in bytes used off heap.
-
-
-
Field Detail
-
dataLength
public final long dataLength
-
compressedFileLength
public final long compressedFileLength
-
indexFilePath
public final java.lang.String indexFilePath
-
parameters
public final CompressionParams parameters
-
-
Constructor Detail
-
CompressionMetadata
public CompressionMetadata(Descriptor desc, long compressedLength)
-
CompressionMetadata
public CompressionMetadata(java.lang.String indexFilePath, long compressedLength, boolean hasMaxCompressedSize)
-
CompressionMetadata
public CompressionMetadata(java.lang.String filePath, CompressionParams parameters, Memory offsets, long offsetsSize, long dataLength, long compressedLength)
-
-
Method Detail
-
create
public static CompressionMetadata create(java.lang.String dataFilePath)
Create metadata about given compressed file including uncompressed data length, chunk size and list of the chunk offsets of the compressed data. This is an expensive operation! Don't create more than one for each sstable.- Parameters:
dataFilePath- Path to the compressed file- Returns:
- metadata about given compressed file.
-
createWithLength
public static CompressionMetadata createWithLength(java.lang.String dataFilePath, long compressedLength)
-
compressor
public ICompressor 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
public void addTo(Ref.IdentityCollection identities)
-
chunkFor
public CompressionMetadata.Chunk chunkFor(long position)
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.
-
getTotalSizeForSections
public long getTotalSizeForSections(java.util.Collection<SSTableReader.PartitionPositionBounds> sections)
- 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(java.util.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
-
close
public void close()
-
-