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
fn wrap_encoder<'a>(
&self,
rec: &dyn MetaRecorded,
file: &'a File
) -> Result<EncodeWrapper<'a>, BarcError>
fn wrap_encoder<'a>(
&self,
rec: &dyn MetaRecorded,
file: &'a File
) -> Result<EncodeWrapper<'a>, BarcError>
Return an EncodeWrapper
for File
by evaluating the
MetaRecorded
for compression worthiness.
Provided methods
fn non_compressible_coef(&self) -> f64
fn non_compressible_coef(&self) -> f64
Return a coefficient used to weight the discount of non-compressible body bytes. Default: 0.5
fn check_identity(&self) -> bool
fn check_identity(&self) -> bool
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)
fn is_compressible(&self, rec: &dyn MetaRecorded) -> bool
fn is_compressible(&self, rec: &dyn MetaRecorded) -> bool
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
.