prioritizationlimit

package
v0.3.0-20260714201009-... Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

README

Prioritization Limit

Vendor-agnostic "how much" policy that bounds how many builds a queue may run at once — the queue's concurrent-build budget.

See the Speculation RFC for the end-to-end design and how limits fit into the two-layer speculation model.

Prioritization Limit

The prioritization limit is the prioritizer's companion. The prioritizer decides which of the queue's pending builds run — its ranking across all in-flight batches; the prioritization limit decides how many fit at once. It is the queue-wide resource knob, the ultimate cap on speculation's demand on CI.

The value is signal-driven, not a fixed constant. Its primary input is the build system's available capacity, but a policy may also weigh cost budgets, time of day, or an experiment toggle.

It is injected into the prioritizer at construction and called by it, never passed as a method parameter — following the repo's extension-contract pattern, keeping the prioritizer interface limit-free and stable, and letting the limit be swapped independently of prioritizer logic.

Factory

A per-queue factory returns the limit policy for a queue, following the repo's extension contract. It is handed only the queue identity; the signals a policy weighs — a capacity feed, cost budgets, config — are injected at construction by the integrator in the wiring layer, which is also where the limit is handed to the prioritizer. Computing the limit itself takes no further inputs.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// QueueName identifies the queue this PrioritizationLimit serves.
	QueueName string
}

Config carries the per-queue identity handed to a Factory. The system knows only the queue name; everything a policy needs to compute the limit (a capacity feed, cost budgets, config) is injected at construction by the integrator.

type Factory

type Factory interface {
	// For returns the PrioritizationLimit for the given queue.
	For(cfg Config) (PrioritizationLimit, error)
}

Factory builds the PrioritizationLimit for a queue. Implementations are provided by integrators (and tests) and inject whatever signals they need at construction.

type PrioritizationLimit

type PrioritizationLimit interface {
	// Limit returns the current maximum number of concurrent builds for the
	// queue. The prioritizer admits at most this many candidates. It takes no
	// parameters; anything an implementation needs is injected at construction.
	Limit(ctx context.Context) (int, error)
}

PrioritizationLimit is the "how much" policy that bounds how many builds a queue may run at once — the queue's concurrent-build budget.

It is the prioritizer's companion: the prioritizer decides *which* of the queue's pending builds run (its ranking across all in-flight batches); the prioritization limit decides *how many* fit at once. It is the queue-wide resource knob, the ultimate cap on speculation's demand on CI.

The value is dynamic: it may change between calls, so the prioritizer reads it each round rather than caching it.

It is injected into the prioritizer at construction and called by it, never passed as a method parameter, keeping the prioritizer interface limit-free and stable.

Directories

Path Synopsis
Package fake provides a programmable prioritizationlimit.PrioritizationLimit for tests and examples.
Package fake provides a programmable prioritizationlimit.PrioritizationLimit for tests and examples.
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package static provides a prioritizationlimit.PrioritizationLimit that always returns a fixed, construction-time value.
Package static provides a prioritizationlimit.PrioritizationLimit that always returns a fixed, construction-time value.

Jump to

Keyboard shortcuts

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