[][src]Trait barc::CompressStrategy

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

Strategies for BARC record compression encoding on write.

Required methods

pub fn wrap_encoder<'a>(
    &self,
    rec: &dyn MetaRecorded,
    file: &'a File
) -> Result<EncodeWrapper<'a>, BarcError>
[src]

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

Loading content...

Provided methods

pub fn min_len(&self) -> u64[src]

Return minimum length of compressible bytes for compression.

pub fn non_compressible_coef(&self) -> f64[src]

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

pub fn check_identity(&self) -> bool[src]

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)

pub fn is_compressible(&self, rec: &dyn MetaRecorded) -> bool[src]

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.

Loading content...

Implementors

impl CompressStrategy for BrotliCompressStrategy[src]

impl CompressStrategy for GzipCompressStrategy[src]

impl CompressStrategy for NoCompressStrategy[src]

pub fn wrap_encoder<'a>(
    &self,
    _rec: &dyn MetaRecorded,
    file: &'a File
) -> Result<EncodeWrapper<'a>, BarcError>
[src]

Return an EncodeWrapper for File. This implementation always returns a Plain wrapper.

Loading content...