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 → 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).
- Cancelling → cancel any in-flight Build entity, respeculate dependents, CAS to terminal Cancelled, publish to conclude. The cancel controller hands the batch off in this state and speculate drives it to terminal.
- Merging → no-op (owned by the merge controller).
- Terminal → re-fan-out to conclude for self-healing in case a prior publish was lost. For terminal Cancelled, also re-fan-out dependents so a crash between the terminal CAS and the dependent publish does not strand them.
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 ¶
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.