Documentation
¶
Index ¶
Constants ¶
const ( // MaxPolicyTimeoutMS is the largest run budget. Above it // time.Duration(timeout_ms)*time.Millisecond overflows int64 and the run // would silently be given a different budget than the one that was priced. MaxPolicyTimeoutMS = int64(math.MaxInt64) / int64(time.Millisecond) // MaxPolicyTimeout is the same budget as the duration it converts into. MaxPolicyTimeout = time.Duration(MaxPolicyTimeoutMS) * time.Millisecond // MaxPolicyBandwidthBPS is the largest bandwidth a single run may ask for. // A bandwidth is summed with the other runs of its executor and of its // destinations before a run is admitted, so this single-run bound is what // keeps those aggregates exact. MaxPolicyBandwidthBPS = int64(resource.MaxBitrate) )
The ranges a policy's numbers are admitted in, in the units the contract states them in: bits per second and whole milliseconds. api/openapi.yaml documents the same bounds. They are applied by CheckPolicyNumbers, so the HTTP boundary and admission hold a policy to one set of ranges: a request that arrives over HTTP is checked before anything is converted from it, and a spec that reaches admission from the control protocol is checked there.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommaSeparatedList ¶
type CommaSeparatedList []string
CommaSeparatedList allows simple lists of strings to be stored in a single database column as a comma-separated string.
func (*CommaSeparatedList) Scan ¶
func (c *CommaSeparatedList) Scan(src any) error
type DebugletPolicy ¶
type DebugletRunState ¶
type DebugletRunState int
const ( RunStateUnspecified DebugletRunState = iota RunStateInitializing RunStateStarted // Additional states managed solely on the dispatcher's side for transparency RunStateUploading RunStateUploaded RunStateExited // RunStateUnreconciled marks a run of a failed submission whose executor // refused its cancellation. The run may still execute; a later state or // exit report from the executor supersedes it. RunStateUnreconciled )
func GrpcToRunState ¶
func GrpcToRunState(r pb.RunState) (DebugletRunState, bool)
func (DebugletRunState) SemanticRank ¶
func (d DebugletRunState) SemanticRank() DebugletRunState
SemanticRank is the run's lifecycle position. The persisted enum values are historical and intentionally do not define transition order.
func (DebugletRunState) String ¶
func (d DebugletRunState) String() string
type DebugletSpec ¶
type PolicyBound ¶
type PolicyBound int
PolicyBound identifies the range a policy's numbers leave. Each caller reports it in its own words, because the message names the field of the contract the caller answers on.
const ( PolicyBoundOK PolicyBound = iota PolicyBoundTimeout PolicyBoundFloor PolicyBoundCeil PolicyBoundCeilBelowFloor )
func CheckPolicyNumbers ¶
func CheckPolicyNumbers(floorBPS, ceilBPS, timeoutMS int64) PolicyBound
CheckPolicyNumbers reports the first admitted range the numbers of a policy leave, and PolicyBoundOK when all of them are admissible. Its arguments are the values as the contract states them, so that a caller can apply it before any conversion, price or aggregate is derived from a number that is not admitted. A budget is bounded in whole milliseconds: the executor admits nothing shorter than one, and the reserved window is what rejects the fraction of a millisecond above the largest admitted budget.
A policy outside several ranges at once is reported by the first of them in the order below — the budget, the floor, the ceiling, and the ceiling against the floor — which is the field the HTTP contract has always named for such a request.
type TransactionState ¶
type TransactionState int
const ( Outstanding TransactionState = iota Expired Aborted Paid Refunded Credited )
func (TransactionState) String ¶
func (d TransactionState) String() string
type UTCTime ¶
UTCTime is a wrapper around time.Time that ensures the time is always stored and retrieved in UTC.