Trait barc::CompressStrategy[][src]

pub trait CompressStrategy {
    fn wrap_encoder<'a>(
        &self,
        rec: &dyn MetaRecorded,
        file: &'a File
    ) -> Result<EncodeWrapper<'a>, BarcError>; fn min_len(&self) -> u64 { ... }
fn non_compressible_coef(&self) -> f64 { ... }
fn check_identity(&self) -> bool { ... }
fn is_compressible(&self, rec: &dyn MetaRecorded) -> bool { ... } }
Expand description

Strategies for BARC record compression encoding on write.

Required methods

Return an EncodeWrapper for File by evaluating the MetaRecorded for compression worthiness.

Provided methods

Return minimum length of compressible bytes for compression.

Return a coefficient used to weight the discount of non-compressible body bytes. Default: 0.5

Return whether to check the meta -decoded header for an “identity” value, as proof that the content-type header actually characterizes the associated body, for the purpose of counting compressible bytes. Default: false (may change in the future)

Return true if the provided record has at least min_len of compressible bytes, from the response and request bodies and headers.

Any non-compressible bytes, from non-compressible bodies, are discounted, weighted by non_compressible_coef.

Implementors