Documentation ¶ Index ¶ Variables type Component type Config type Group func New(config Config) *Group func (g *Group) Add(component Component) func (g *Group) Run(ctx context.Context) error Constants ¶ This section is empty. Variables ¶ View Source var ErrJoinTimeout = errors.New("server component join timed out") Functions ¶ This section is empty. Types ¶ type Component ¶ type Component struct { Name string Run func(context.Context) error Stop func(context.Context) error } type Config ¶ type Config struct { ShutdownTimeout time.Duration OnDrain func() } type Group ¶ type Group struct { // contains filtered or unexported fields } func New ¶ func New(config Config) *Group func (*Group) Add ¶ func (g *Group) Add(component Component) func (*Group) Run ¶ func (g *Group) Run(ctx context.Context) error Run owns the complete process lifecycle. The first unexpected component exit begins draining, cancels every sibling, invokes stops in reverse order, and joins all component goroutines before returning. Source Files ¶ View all Source files group.go Click to show internal directories. Click to hide internal directories.