pingora_cache::storage

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<usize>> + Send + 'async_trait>>
       where Self: 'async_trait;

    // Provided method
    fn streaming_write_tag(&self) -> Option<&[u8]> { ... }
}
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<usize>> + 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.

Implementors§