[−][src]Trait barc::CompressStrategy
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>
&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 min_len(&self) -> u64
Return minimum length of compressible bytes for compression.
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
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
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
impl CompressStrategy for BrotliCompressStrategy
[src]
fn wrap_encoder<'a>(
&self,
rec: &dyn MetaRecorded,
file: &'a File
) -> Result<EncodeWrapper<'a>, BarcError>
[src]
&self,
rec: &dyn MetaRecorded,
file: &'a File
) -> Result<EncodeWrapper<'a>, BarcError>
fn min_len(&self) -> u64
[src]
fn check_identity(&self) -> bool
[src]
impl CompressStrategy for GzipCompressStrategy
[src]
fn wrap_encoder<'a>(
&self,
rec: &dyn MetaRecorded,
file: &'a File
) -> Result<EncodeWrapper<'a>, BarcError>
[src]
&self,
rec: &dyn MetaRecorded,
file: &'a File
) -> Result<EncodeWrapper<'a>, BarcError>
fn min_len(&self) -> u64
[src]
fn check_identity(&self) -> bool
[src]
impl CompressStrategy for NoCompressStrategy
[src]
fn wrap_encoder<'a>(
&self,
_rec: &dyn MetaRecorded,
file: &'a File
) -> Result<EncodeWrapper<'a>, BarcError>
[src]
&self,
_rec: &dyn MetaRecorded,
file: &'a File
) -> Result<EncodeWrapper<'a>, BarcError>
Return an EncodeWrapper
for File
. This implementation
always returns a Plain
wrapper.