Skip to main content

DemotionHook

Trait DemotionHook 

Source
pub trait DemotionHook: Send + Sync {
    // Required method
    fn demote<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 str,
        messages: Vec<Message>,
    ) -> Pin<Box<dyn Future<Output = Result<usize, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Hook for demoting old messages to long-term storage.

When the active window exceeds its token budget, messages evicted from the window are passed to the demotion hook for archival. This ensures no information is silently lost.

Required Methods§

Source

fn demote<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, messages: Vec<Message>, ) -> Pin<Box<dyn Future<Output = Result<usize, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Demotes messages to long-term storage.

Returns the number of messages successfully stored.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§