warmer

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package warmer keeps a follower's incremental render graph warm.

Only the leader's Coordinator renders to deploy, so without this a follower's graph sits at generation zero and every leadership change starts with a cold render. The warmer runs the same reconcile render on every trigger a follower receives and commits it, which is what publishes the graph, then discards the output: nothing it renders reaches the fleet, the API server, or any other component.

Index

Constants

View Source
const (
	// ComponentName is the unique identifier for this component.
	ComponentName = "render-warmer"

	// EventBufferSize matches the Coordinator's: the trigger stream is one
	// event per resource change, and the mailbox collapses it to one render.
	EventBufferSize = busevents.ResourceChurnSubscriberBuffer
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	*component.Base
	// contains filtered or unexported fields
}

Component renders on a follower and cancels its work when leadership changes.

func New

func New(cfg *Config) *Component

New subscribes the component; call before the bus starts.

func (*Component) CoalescesAcrossQueue

func (c *Component) CoalescesAcrossQueue() bool

CoalescesAcrossQueue keeps one trigger queued whatever sits between them: a leadership event does not make an older trigger worth a render of its own.

func (*Component) CoalescesOn

func (c *Component) CoalescesOn() []string

CoalescesOn collapses a burst of triggers to the latest one: every render re-reads the stores, so the newest trigger is all a follower needs.

func (*Component) HandleEvent

func (c *Component) HandleEvent(event busevents.Event)

HandleEvent implements component.EventHandler.

func (*Component) RenderInFlight added in v0.7.0

func (c *Component) RenderInFlight() <-chan struct{}

RenderInFlight returns a channel closed when the follower render running now ends, or nil when none is running.

func (*Component) Start

func (c *Component) Start(ctx context.Context) error

Start drains leadership events independently of the single render worker.

func (*Component) Warmed

func (c *Component) Warmed() <-chan struct{}

Warmed is closed once a render left a committed graph behind, which is when a hand-over to this iteration finds a warm graph. A render whose cache the next input change discarded does not count; that change's own trigger renders again.

type Config

type Config struct {
	EventBus      *busevents.EventBus
	Pipeline      PipelineExecutor
	StoreProvider stores.StoreProvider
	// CurrentFilesSource returns a root-tracked view of the auxiliary files
	// the fleet runs, the same set a new leader's first render reads. A
	// root-tracked source — rather than a map snapshot — lets consecutive
	// renders prove the currentFiles input unchanged, which the exact-cycle
	// replay requires; a follower rendering from plain maps misses the replay
	// on every render and pays a full render each time.
	CurrentFilesSource func() (rendercontext.CurrentAuxFilesSource, error)
	// GraphWarm reports whether the render service holds a committed graph;
	// Warmed closes after the first render that leaves one. Nil means every
	// completed render counts.
	GraphWarm func() bool
	Metrics   *metrics.Metrics
	Logger    *slog.Logger
}

Config wires a Component.

type PipelineExecutor

type PipelineExecutor interface {
	Execute(ctx context.Context, provider stores.StoreProvider, mode rendercontext.RenderMode, extraOpts ...rendercontext.Option) (*pipeline.PipelineResult, error)
}

PipelineExecutor renders and commits; the warmer never reads the output.

Jump to

Keyboard shortcuts

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