pub trait UsageStore: Send + Sync {
// Required methods
fn append_usage<'life0, 'async_trait>(
&'life0 self,
record: UsageRecord,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list_usage<'life0, 'async_trait>(
&'life0 self,
run_id: Option<Uuid>,
) -> Pin<Box<dyn Future<Output = Result<Vec<UsageRecord>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn insert_pricing<'life0, 'async_trait>(
&'life0 self,
pricing: ModelPricing,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_pricing<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
provider: &'life1 str,
model: &'life2 str,
version: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ModelPricing>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn list_pricing<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
provider: &'life1 str,
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ModelPricing>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn list_all_pricing<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ModelPricing>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Stores accounting records independently of transient run events and telemetry.
Usage records are append-only and keyed by invocation ID. Re-appending an identical record is idempotent; reusing an ID for different data is rejected. Pricing versions are immutable once inserted.
Required Methods§
fn append_usage<'life0, 'async_trait>(
&'life0 self,
record: UsageRecord,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_usage<'life0, 'async_trait>(
&'life0 self,
run_id: Option<Uuid>,
) -> Pin<Box<dyn Future<Output = Result<Vec<UsageRecord>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn insert_pricing<'life0, 'async_trait>(
&'life0 self,
pricing: ModelPricing,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_pricing<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
provider: &'life1 str,
model: &'life2 str,
version: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ModelPricing>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn list_pricing<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
provider: &'life1 str,
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ModelPricing>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn list_all_pricing<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ModelPricing>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".