#[non_exhaustive]pub struct RecordSpendArgs {
pub budget_id: BudgetId,
pub execution_id: ExecutionId,
pub deltas: BTreeMap<String, u64>,
pub idempotency_key: String,
}Expand description
Args for crate::engine_backend::EngineBackend::record_spend.
Carries an open-set BTreeMap<String, u64> of dimension deltas
per cairn’s ground-truth shape at
cairn-fabric/src/engine/control_plane_types.rs. Cairn budgets are
per-tenant open-schema (tenant A tracks "tokens" + "cost_cents",
tenant B tracks "egress_bytes"), distinct from FF’s fixed-shape
[UsageDimensions] which encodes the internal usage-report surface.
BTreeMap (not HashMap) gives stable iteration order — consistent
with UsageDimensions::custom, and critical for the PG body which
updates multiple dimension rows per call (deterministic ordering
prevents deadlocks under concurrent spend).
Return shape reuses ReportUsageResult — same four variants
(Ok / SoftBreach / HardBreach / AlreadyApplied) cairn’s UI
branches on. Not a new enum.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.budget_id: BudgetId§execution_id: ExecutionId§deltas: BTreeMap<String, u64>Per-dimension positive deltas. Tenant-defined keys; stable iteration order.
idempotency_key: StringCaller-computed idempotency key (cairn uses SHA-256 hex of
budget_id || execution_id || sorted(deltas)). FF does not
interpret the bytes — dedup is a simple equality check against
the prior stamped key.
Implementations§
Trait Implementations§
Source§impl Clone for RecordSpendArgs
impl Clone for RecordSpendArgs
Source§fn clone(&self) -> RecordSpendArgs
fn clone(&self) -> RecordSpendArgs
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more