Skip to main content

CompressionInfo

Struct CompressionInfo 

Source
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: String

Compression 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: u32

Size of uncompressed data chunks (bytes)

§max_compressed_length: u32

Maximum 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: u64

Total 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

Source

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.

Source

pub fn chunk_for_offset(&self, offset: u64) -> usize

Get the chunk index for a given offset in the uncompressed data

Source

pub fn offset_within_chunk(&self, offset: u64) -> u64

Get the offset within a chunk for a given global offset

Source

pub fn compressed_chunk_offset(&self, chunk_index: usize) -> Option<u64>

Get the compressed chunk offset for a given chunk index

Source

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

Source

pub fn validate(&self) -> Result<()>

Validate the compression info structure

Trait Implementations§

Source§

impl Clone for CompressionInfo

Source§

fn clone(&self) -> CompressionInfo

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CompressionInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.