package
Version:
v1.126.0-rc
Opens a new window with list of versions in this module.
Published: Mar 26, 2025
License: AGPL-3.0
Opens a new window with license information.
Imports: 13
Opens a new window with list of imports.
Imported by: 3
Opens a new window with list of known importers.
Documentation
¶
Package lifecycle allows controlling group of items.
Group implements a collection of items that have a
concurrent start and are closed in reverse order.
func NewGroup(log *zap.Logger) *Group
NewGroup creates a new group.
func (group *Group) Add(item Item)
Add adds item to the group.
func (group *Group) Close() error
Close closes all items in reverse order.
func (group *Group) Run(ctx context.Context, g *errgroup.Group)
Run starts all items concurrently under group g.
type Item struct {
Name string
Run func(ctx context.Context) error
Close func() error
}
Item is the lifecycle item that group runs and closes.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.