Skip to main content

HandleMiss

Trait HandleMiss 

Source
pub trait HandleMiss {
    // Required methods
    fn write_body<'life0, 'async_trait>(
        &'life0 mut self,
        data: Bytes,
        eof: bool,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn finish<'async_trait>(
        self: Box<Self>,
    ) -> Pin<Box<dyn Future<Output = Result<MissFinishType>> + Send + 'async_trait>>
       where Self: 'async_trait;

    // Provided methods
    fn streaming_write_tag(&self) -> Option<&[u8]> { ... }
    fn entry_id(&self) -> Option<CacheEntryId> { ... }
}
Expand description

Cache miss handling trait

Required Methods§

Source

fn write_body<'life0, 'async_trait>( &'life0 mut self, data: Bytes, eof: bool, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Write the given body to the storage

Source

fn finish<'async_trait>( self: Box<Self>, ) -> Pin<Box<dyn Future<Output = Result<MissFinishType>> + Send + 'async_trait>>
where Self: 'async_trait,

Finish the cache admission

When self is dropped without calling this function, the storage should consider this write failed.

Provided Methods§

Source

fn streaming_write_tag(&self) -> Option<&[u8]>

Return a streaming write tag recognized by the underlying Storage.

This is an arbitrary data identifier that is used to associate this miss handler’s current write with a hit handler for the same write. This identifier will be compared by the storage during lookup_streaming_write.

Source

fn entry_id(&self) -> Option<CacheEntryId>

Return the identity of the entry produced by this write to the eviction manager.

Storage that identifies a stored generation beyond its crate::key::CompactCacheKey should return that identity here so admission and weight updates target the entry that storage will produce. Storage that keys eviction only on the cache key should leave this at the default None.

The value must identify the committed entry and remain valid after Self::finish. It must not identify only temporary write state. Storage that identifies entries must implement both this method and HandleHit::entry_id using the same identity scheme.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§