pub enum CompressionCache {
Disabled,
Enabled(CompressionCacheInner),
}
Expand description
An LRU cache for compressions.
The prospect of being able to reuse a given compression for many connections
means we can afford to spend more time on that compression (by passing
CompressionLevel::Amortized
to the compressor).
Variants§
Disabled
No caching happens, and compression happens each time using
CompressionLevel::Interactive
.
Enabled(CompressionCacheInner)
Compressions are stored in an LRU cache.
Implementations§
source§impl CompressionCache
impl CompressionCache
sourcepub fn new(size: usize) -> Self
pub fn new(size: usize) -> Self
Make a CompressionCache
that stores up to size
compressed
certificate messages.
sourcepub(crate) fn compression_for(
&self,
compressor: &dyn CertCompressor,
original: &CertificatePayloadTls13<'_>,
) -> Result<Arc<CompressionCacheEntry>, CompressionFailed>
pub(crate) fn compression_for( &self, compressor: &dyn CertCompressor, original: &CertificatePayloadTls13<'_>, ) -> Result<Arc<CompressionCacheEntry>, CompressionFailed>
Return a CompressionCacheEntry
, which is an owning
wrapper for a CompressedCertificatePayload
.
compressor
is the compression function we have negotiated.
original
is the uncompressed certificate message.
fn compression_for_impl( &self, compressor: &dyn CertCompressor, original: &CertificatePayloadTls13<'_>, ) -> Result<Arc<CompressionCacheEntry>, CompressionFailed>
sourcefn uncached_compression(
compressor: &dyn CertCompressor,
original: &CertificatePayloadTls13<'_>,
) -> Result<Arc<CompressionCacheEntry>, CompressionFailed>
fn uncached_compression( compressor: &dyn CertCompressor, original: &CertificatePayloadTls13<'_>, ) -> Result<Arc<CompressionCacheEntry>, CompressionFailed>
Compress original
using compressor
at Interactive
level.
Trait Implementations§
source§impl Debug for CompressionCache
impl Debug for CompressionCache
Auto Trait Implementations§
impl !Freeze for CompressionCache
impl RefUnwindSafe for CompressionCache
impl Send for CompressionCache
impl Sync for CompressionCache
impl Unpin for CompressionCache
impl UnwindSafe for CompressionCache
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more