models

package
v0.2.0-rc.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
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

func (CommaSeparatedList) Value

func (c CommaSeparatedList) Value() (driver.Value, error)

type DebugletPolicy

type DebugletPolicy struct {
	FloorBW     resource.Bitrate
	CeilBW      resource.Bitrate
	Timeout     time.Duration
	Addresses   []string
	RequireICMP bool
	ListenUDP   bool
	ListenTCP   bool
	ListenSCION bool
}

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 DebugletSpec struct {
	StartTime  *time.Time
	Wasm       []byte
	Args       []string
	Policy     DebugletPolicy
	ExecutorID string
	// TransactionID is required for refunding aborted debuglets
	TransactionID string
	OrderID       int64
}

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
	Refunded
	Credited
)

func (TransactionState) String

func (d TransactionState) String() string

type UTCTime

type UTCTime struct {
	time.Time
}

UTCTime is a wrapper around time.Time that ensures the time is always stored and retrieved in UTC.

func NewUTCTime

func NewUTCTime(t time.Time) UTCTime

func (*UTCTime) Scan

func (t *UTCTime) Scan(src any) error

func (UTCTime) Value

func (t UTCTime) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL