Skip to main content

UsageRepository

Trait UsageRepository 

Source
pub trait UsageRepository: Send + Sync {
    // Required methods
    fn load_session_usage<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SessionUsageRow>, DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn upsert_session_usage<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        session_id: &'life1 str,
        model: &'life2 str,
        stats: &'life3 SessionStats,
    ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

Session-usage persistence boundary used by app orchestration and tests.

Required Methods§

Source

fn load_session_usage<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<SessionUsageRow>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Loads per-model token usage rows for a session, ordered by model name.

Source

fn upsert_session_usage<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, session_id: &'life1 str, model: &'life2 str, stats: &'life3 SessionStats, ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Accumulates per-model token usage for a session.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§