pub struct CompressionInfo {
pub algorithm: String,
pub option_pairs: Vec<(String, String)>,
pub chunk_length: u32,
pub max_compressed_length: u32,
pub data_length: u64,
pub chunk_offsets: Vec<u64>,
}Expand description
CompressionInfo.db file content parsed from binary format
Fields§
§algorithm: StringCompression algorithm simple name (e.g., “LZ4Compressor”, “SnappyCompressor”)
option_pairs: Vec<(String, String)>Optional compression parameters from CompressionInfo.db Key-value pairs as written by CompressionMetadata.writeHeader()
chunk_length: u32Size of uncompressed data chunks (bytes)
max_compressed_length: u32Maximum compressed chunk length; if a compressed chunk reaches this size, the chunk was stored uncompressed in Data.db instead. Equals i32::MAX when minCompressRatio=0 (the default). Source: CompressionParams.java:186-189.
data_length: u64Total uncompressed data length (bytes)
chunk_offsets: Vec<u64>List of compressed chunk offsets in Data.db file
Each offset points to the start of a compressed-chunk record. The record consists of:
[compressed_bytes][4-byte CRC32 of compressed_bytes]
The delta between consecutive offsets therefore includes the trailing 4-byte CRC.
See: CompressedSequentialWriter.java:203 chunkOffset += compressedLength + 4
Implementations§
Source§impl CompressionInfo
impl CompressionInfo
Sourcepub fn parse(data: &[u8]) -> Result<Self>
pub fn parse(data: &[u8]) -> Result<Self>
Parse CompressionInfo.db file from binary data.
Implements the deterministic layout from CompressionMetadata.java:375-392. No heuristics — every field is read at its authoritative position.
Sourcepub fn chunk_for_offset(&self, offset: u64) -> usize
pub fn chunk_for_offset(&self, offset: u64) -> usize
Get the chunk index for a given offset in the uncompressed data
Sourcepub fn offset_within_chunk(&self, offset: u64) -> u64
pub fn offset_within_chunk(&self, offset: u64) -> u64
Get the offset within a chunk for a given global offset
Sourcepub fn compressed_chunk_offset(&self, chunk_index: usize) -> Option<u64>
pub fn compressed_chunk_offset(&self, chunk_index: usize) -> Option<u64>
Get the compressed chunk offset for a given chunk index
Sourcepub fn compressed_chunk_size(
&self,
chunk_index: usize,
total_compressed_size: u64,
) -> Option<u64>
pub fn compressed_chunk_size( &self, chunk_index: usize, total_compressed_size: u64, ) -> Option<u64>
Get the size of a compressed-chunk record (delta between consecutive offsets or end-of-file), INCLUDING the 4-byte trailing CRC appended inline in Data.db.
To get the actual compressed payload size, subtract 4 from the returned value.
See: CompressedSequentialWriter.java:203 chunkOffset += compressedLength + 4
Trait Implementations§
Source§impl Clone for CompressionInfo
impl Clone for CompressionInfo
Source§fn clone(&self) -> CompressionInfo
fn clone(&self) -> CompressionInfo
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more