speculate

package
v0.1.0-dev2 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

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 speculate queue messages.

Naive happy-path algorithm: assume every in-flight build will pass and treat batch.Dependencies + [batch.ID] as the single speculation chain. Per invocation, the controller advances the batch one step in the state machine:

  • Created or Scored → publish to build, transition to Speculating.
  • Speculating → if all deps are Succeeded, publish to merge and transition to Merging; otherwise no-op (or fail-fast if a dep is in a non-succeeding terminal state).
  • Merging → no-op (owned by the merge controller).
  • Terminal → re-fan-out to conclude for self-healing in case a prior publish was lost.

The controller is re-triggered on every relevant downstream event (buildsignal, merge), so each call simply re-evaluates the current state and either advances or waits.

func NewController

func NewController(
	logger *zap.SugaredLogger,
	scope tally.Scope,
	store storage.Storage,
	registry consumer.TopicRegistry,
	topicKey consumer.TopicKey,
	consumerGroup string,
) *Controller

NewController creates a new speculate 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 advances a batch one step along the naive happy-path. Returns nil to ack (success), or error to nack (retry).

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