Skip to main content

PayloadStore

Trait PayloadStore 

Source
pub trait PayloadStore: Send + Sync {
    // Required methods
    fn put<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
        bytes: &'life2 [u8],
        death_epoch: SystemTime,
    ) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn read<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, CamelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn unlink<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn clear<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Pluggable payload storage behind OffloadRepository.

The decorator owns ALL policy — blob naming, death-epoch math, the index-row shape, and every fallback (ADR-0065) — and calls the store with finished blob names. Implementations only move opaque bytes.

Required Methods§

Source

fn put<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, name: &'life1 str, bytes: &'life2 [u8], death_epoch: SystemTime, ) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Store bytes under name until death_epoch.

name is the decorator’s content-addressed blob name; stores must reject names that are not bare single path components. A store that cannot honor death_epoch returns Err — the decorator’s inline fallback applies, so a payload is never stored without its deadline.

Source

fn read<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, CamelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read the payload stored under name.

Ok(None) = the payload is gone (reclaimed, evicted, lost): the decorator degrades to a MISS with WARN. An existing-but-unreadable payload is Err (ADR-0023 Contract C1), never a silent None.

Remove the payload stored under name.

An already-absent payload counts as success (a concurrent reclaimer won the race).

Provided Methods§

Source

fn clear<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Best-effort bulk reclamation of every stored payload.

Default: no-op — a store whose payloads carry their own deadline (e.g. a redis EXAT) or a background sweeper needs no eager clear. Implementers must WARN and continue on per-payload failures: the decorator never surfaces clear failures as Err (ADR-0065 failure policy).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§