Documentation
¶
Overview ¶
Package orchestrator coordinates health-gated service startup in tiered order.
Index ¶
- type LogFetcher
- type Orchestrator
- func (o *Orchestrator) PreFlight(envFile, exampleFile string, schema map[string]config.EnvVar) (bool, map[string]string)
- func (o *Orchestrator) StartTier(ctx context.Context, tier Tier, deps []string, ...) error
- func (o *Orchestrator) StartTierPartial(ctx context.Context, tier Tier, deps []string, ...) ([]string, error)
- func (o *Orchestrator) StartTierWithResults(ctx context.Context, tier Tier, deps []string, ...) ([]printer.ServiceResult, error)
- type Tier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogFetcher ¶
type LogFetcher interface {
TailLogs(ctx context.Context, containerID string, lines int, w io.Writer) error
ContainerIDByName(serviceName string) (string, error)
}
LogFetcher abstracts container log retrieval for failure diagnostics.
type Orchestrator ¶
type Orchestrator struct {
// contains filtered or unexported fields
}
Orchestrator manages the startup sequence and health checking of services.
func New ¶
func New(p *printer.Printer) *Orchestrator
New creates an Orchestrator that reports progress via the given printer.
func (*Orchestrator) PreFlight ¶
func (o *Orchestrator) PreFlight(envFile, exampleFile string, schema map[string]config.EnvVar) (bool, map[string]string)
PreFlight validates environment variables and injects schema defaults. Returns true if validation passes, along with a map of injected default values.
func (*Orchestrator) StartTier ¶
func (o *Orchestrator) StartTier(ctx context.Context, tier Tier, deps []string, startFn func(context.Context, []string) error, checkers map[string]health.Named, fetcher LogFetcher) error
StartTier starts all services in a tier and waits for their health checks to pass. Health checks run in parallel. On failure, it surfaces container logs and suggests fixes.
func (*Orchestrator) StartTierPartial ¶
func (o *Orchestrator) StartTierPartial(ctx context.Context, tier Tier, deps []string, startFn func(context.Context, []string) error, checkers map[string]health.Named, fetcher LogFetcher) ([]string, error)
StartTierPartial starts all services in a tier and returns the names of failed services instead of stopping on first failure. Returns a non-nil error only for startup failures (not health check failures).
func (*Orchestrator) StartTierWithResults ¶
func (o *Orchestrator) StartTierWithResults(ctx context.Context, tier Tier, deps []string, startFn func(context.Context, []string) error, checkers map[string]health.Named, fetcher LogFetcher) ([]printer.ServiceResult, error)
StartTierWithResults is like StartTier but also returns service results for the summary table.
type Tier ¶
type Tier []string
Tier is a group of services that can start in parallel.
func BuildTiers ¶
BuildTiers returns services grouped into startup tiers using Kahn's algorithm. Services in tier N have all their dependencies satisfied by tiers 0..N-1. Returns an error if a dependency cycle is detected. Complexity: O(V+E) where V = services and E = dependency edges.