pub struct BudgetBlock {
pub name: String,
pub quotas: Vec<BudgetQuota>,
pub on_exhausted: String,
pub loc: Loc,
pub leading_trivia: Vec<Trivia>,
pub trailing_trivia: Vec<Trivia>,
}Expand description
v2.28.0 — a budget { … } block: a set of per-effect rate quotas plus the
exhaustion policy. Where window guards an effect’s TIMING, budget guards
its RATE — a tool call consumes one token from a renewable bucket, and
over-emission is impossible by construction (the Logic pillar’s linearity
made real for external effects).
Fields§
§name: Stringv2.69.0 — the budget’s NAME when it is declared top-level.
Empty ⇒ the daemon-attached form (daemon D { budget { … } }), which is
anonymous and scoped to that daemon’s ticks.
§Why top-level had to exist
Until v2.69.0, budget was a field of daemon and nothing else. So an
adopter deploying an HTTP endpoint that calls a vendor tool had no way in
the language to bound how often it does that. Not “the bound did not
work” — the bound could not be written. And the HTTP endpoint is what
people actually deploy.
quotas: Vec<BudgetQuota>The per-effect quotas (rate:/max: lines). At least one.
on_exhausted: StringWhat to do when a quota is exhausted: block (fail-closed, the default) |
defer (reschedule via the v2.27.0 defer ledger) | shed (skip the call).
loc: Loc§leading_trivia: Vec<Trivia>v2.69.0 — comment trivia, so a top-level budget does not silently lose
its doc comments through the formatter (v1.5.2). Empty for the
daemon-attached form.
trailing_trivia: Vec<Trivia>