Documentation
¶
Overview ¶
Package current runs the working revision of one package: its configuration, hooks and release. Start with next.go (every rule of Current), then loop.go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Name string
Kind model.Kind
Revision model.Revision // Revision is the revision to run; the package Reconciler owns its image.
// Restored: started from a settings checkpoint, so the package has run (state.ran).
Restored bool
}
Config is what the package Reconciler passes to Start.
type Deps ¶
type Deps struct {
Scheduler publisher
Nelm nelmService
Hooks hookLanes
Orphans orphanPurger
ModulesNamespace string
Metrics metrics.PackageGauges // Metrics records the init_hooks phase; nil records none.
Clock retry.Clock // Clock nil means the wall clock.
Logger *log.Logger // Logger nil means a no-op logger.
}
Deps are the effects of every Current; shared by all of them and safe for concurrent use.
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
Reconciler is Current: it runs one loaded revision, publishes only its own facts and writes only the Current section. The loop owns all state and decides with next; one operation at a time runs in a worker the loop starts and cancels, because an upgrade can take minutes and a new configuration, a disable, Stop or Uninstall must cancel it.
A disabled package keeps its Current: a module's decision is computed on its node, which must stay in the graph. A disabled package still accepts configurations: the enabled script reads its settings from the object.
func Start ¶
func Start(ctx context.Context, cfg Config, deps Deps, reporter reportWriter) *Reconciler
Start starts the loop without a configuration; the package Reconciler pushes one when it has one. The first run waits for an accepted configuration and an event that echoes it. Non-blocking.
func (*Reconciler) Push ¶
func (r *Reconciler) Push(config *model.Configuration, checksum string, ev *schedule.Event)
Push records the latest configuration with its configstate.Key, and the latest event; nil leaves that input as it is. The caller computes the checksum once per configuration: Push runs on every wake of the package Reconciler. Non-blocking.
func (*Reconciler) Revision ¶
func (r *Reconciler) Revision() model.Revision
Revision returns the running revision.
func (*Reconciler) Stop ¶
func (r *Reconciler) Stop()
Stop cancels the operation in progress, stops the hooks and waits for the loop to exit, so a stopped Current never writes again. It keeps the release and the image. Nil-safe.
func (*Reconciler) Uninstall ¶
func (r *Reconciler) Uninstall(ctx context.Context) error
Uninstall retries until it succeeds; an error only when ctx is cancelled. It reads no event: the uninstall wins over everything (next, rule 1). The loop has exited when it returns; the image stays attached. Nil-safe.