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 ¶
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 ¶
Component renders on a follower and cancels its work when leadership changes.
func (*Component) CoalescesAcrossQueue ¶
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 ¶
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 ¶
HandleEvent implements component.EventHandler.
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.