build

package
v0.3.0-20260820034428-... Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package build starts the builds a head batch's speculation paths have been funded for. A message names only the head; the path set is the instruction, and each pending entry in it is a build to start. Nothing about the action travels on the wire, so a dispatch cannot go stale between publish and delivery: a path refuted after its message was sent is simply no longer pending by the time the set is read.

This stage only starts builds. Stopping them is the poll loop's job: every build started here is handed to the buildsignal stage, which follows it to a terminal state and stops it the moment its path no longer wants it. The split is what keeps this stage simple — it decides whether a build should exist, never whether one should die — and it holds together because of one invariant this stage maintains: every build that gets a link gets a signal (see ensureSignal for the crash case).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller handles build queue messages. Implements consumer.Controller interface for integration with the consumer.

func NewController

func NewController(
	logger *zap.SugaredLogger,
	scope tally.Scope,
	stores storage.Factory,
	buildRunners buildrunner.Factory,
	registry consumer.TopicRegistry,
	topicKey consumer.TopicKey,
	consumerGroup string,
) *Controller

NewController creates a new build controller for the orchestrator.

func (*Controller) ConsumerGroup

func (c *Controller) ConsumerGroup() string

ConsumerGroup returns the consumer group for offset tracking.

func (*Controller) Name

func (c *Controller) Name() string

Name returns the controller name for logging and metrics.

func (*Controller) Process

func (c *Controller) Process(ctx context.Context, delivery consumer.Delivery) error

Process starts a build for every pending path in the head's set. Returns nil to ack (success), or error to nack (retry).

This controller never writes the path set. The set is the speculate run's state — what it decided to fund and what it wants stopped — and a second writer on it would make speculate lose compare-and-swap races across its own far longer read-decide-write window. What this stage knows is the build it started, and that goes in records of its own.

A failure partway through nacks the whole message and redelivery re-runs all of it: starts are made idempotent by the link record each one writes (see startPath), and a redelivery additionally re-publishes the signal for any live path already linked to a build, in case the crashed attempt died between the link and the signal (see ensureSignal).

func (*Controller) TopicKey

func (c *Controller) TopicKey() consumer.TopicKey

TopicKey returns the topic key this controller subscribes to.

Jump to

Keyboard shortcuts

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