A node-local monotonic deadline shared by every stage of an operation.
Construct it once at admission. Passing it between stages preserves the original budget; it is not a portable timestamp or a wire value.
Summary
Types
An optional node-local monotonic clock sample in milliseconds, used instead of sampling the current clock.
A node-local monotonic millisecond cutoff. Share it between stages; never serialize it as a portable deadline.
Functions
Creates a deadline from a positive millisecond budget.
Returns the remaining milliseconds, clamped to zero after expiry.
Types
@type option() :: {:now, integer()}
An optional node-local monotonic clock sample in milliseconds, used instead of sampling the current clock.
@opaque t()
A node-local monotonic millisecond cutoff. Share it between stages; never serialize it as a portable deadline.
Functions
@spec new(pos_integer(), [option()]) :: t()
Creates a deadline from a positive millisecond budget.
@spec remaining(t(), [option()]) :: non_neg_integer()
Returns the remaining milliseconds, clamped to zero after expiry.