Skip to main content

MeterEventProvider

Trait MeterEventProvider 

Source
pub trait MeterEventProvider: Send + Sync {
    // Required method
    fn submit<'a>(
        &'a self,
        batch: &'a [AggregatedUsage],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<MeterEventOutcome>, MeterEventProviderError>> + Send + 'a>>;
}
Expand description

Submits ordered batches of pre-aggregated usage to a billing provider.

Implementations must return exactly one ordered MeterEventOutcome for every submitted aggregate. They must treat AggregatedUsage::identifier as an idempotency key because cancellation and batch-wide failures can leave an accepted event’s result ambiguous.

Required Methods§

Source

fn submit<'a>( &'a self, batch: &'a [AggregatedUsage], ) -> Pin<Box<dyn Future<Output = Result<Vec<MeterEventOutcome>, MeterEventProviderError>> + Send + 'a>>

Submit a batch and return one outcome for each aggregate in the same order.

A batch-wide error means no per-event outcome is available. Error and outcome codes must be static, low-cardinality categories and must not contain credentials, customer data, or other identifying values.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§