PtcRunner.Kernel.Deadline (PtcRunner v0.14.0)

Copy Markdown View Source

Absolute monotonic deadline shared by bounded Kernel operations.

A deadline is anchored once. Passing it to nested work preserves the same cutoff; callers may select an earlier deadline but cannot extend one by reconstructing a relative timeout.

Summary

Functions

Selects the earlier of two already-anchored deadlines.

Returns whether the monotonic cutoff has been reached.

Creates a deadline from a shared monotonic anchor.

Returns the non-negative duration remaining before the cutoff.

Budget for recording an outcome that must outlive the caller's deadline.

Types

t()

@opaque t()

Functions

earliest(left_deadline, right_deadline)

@spec earliest(t(), t()) :: t()

Selects the earlier of two already-anchored deadlines.

expired?(deadline)

@spec expired?(t()) :: boolean()

Returns whether the monotonic cutoff has been reached.

new(timeout_ms)

@spec new(pos_integer()) :: t()

new(timeout_ms, anchor_ms)

@spec new(pos_integer(), integer()) :: t()

Creates a deadline from a shared monotonic anchor.

remaining(deadline)

@spec remaining(t()) :: non_neg_integer()

Returns the non-negative duration remaining before the cutoff.

terminalization(expires_at_ms)

@spec terminalization(integer()) :: t()

Budget for recording an outcome that must outlive the caller's deadline.

A worker that crossed a dispatch fence has to report how the dispatch ended even when it learns that outcome after the caller's cutoff. Budgeting that report with max(remaining, 1) gave the store call one millisecond once the deadline had passed; under load the call timed out, the discarded report left the mutation lease :dispatched, and every later acquire returned :mutation_indeterminate. The floor keeps any longer live budget and never lets the report's allowance collapse with the caller's.