Skip to main content

budget_extensions

Function budget_extensions 

Source
pub fn budget_extensions(log: &[EventEnvelope]) -> BudgetExtensions
Expand description

Folds a recorded log into the extensions a budget check has been granted.

The loop absorbs an extension exactly when a resume answers a budget crossing, so this absorbs the input of a Event::Resumed whose immediately preceding event is a Event::BudgetExceeded, and no other. That adjacency is not a heuristic: ctx.budget_exceeded records the crossing and the await_resume that follows it records the answer, with nothing in between. A resume answering a suspension is a different conversation and is deliberately not absorbed here, even if its input happens to carry a key spelled extend.

Like budget_observations, this is the whole log because the loop replays: on resume the driver re-absorbs every recorded extension in order before it reaches the live edge.