Documentation
¶
Overview ¶
Package lifecycle provides a minimal orchestration primitive for running concurrent components that share a single context for cancellation and graceful shutdown via OS signals.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run orchestrates one or more components. It accepts Component values (or bare func(ctx context.Context) error). It creates a context cancelled on SIGTERM or SIGINT, launches every component as a goroutine in an errgroup, and waits for all of them to finish. If any component returns an error the shared context is cancelled, signalling the remaining components to shut down. The first non-nil error (if any) is returned.
Types ¶
Click to show internal directories.
Click to hide internal directories.