Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Stage ¶
type Stage interface {
// Go starts f in a new goroutine attached to the Stage.
// Stage context is passed to f as an argument. f should stop when context signals done.
// If f returns a non-nil error, the stager starts performing shutdown.
Go(f func(context.Context) error)
// GoWhenDone starts f in a new goroutine attached to the Stage when the stage starts shutting down.
// Stage shutdown waits for f to exit.
GoWhenDone(f func() error)
}
type StageFunc ¶ added in v0.3.0
type StageFunc func(Stage)
StageFunc is a function that uses the provided Stage to start goroutines.
type Stager ¶
type Stager interface {
// NextStage adds a new stage to the Stager.
NextStage() Stage
// NextStageWithContext adds a new stage to the Stager. Provided ctxParent is used as the parent context for the
// Stage's context.
NextStageWithContext(ctxParent context.Context) Stage
// Run blocks until ctx signals done or a function in a stage returns a non-nil error.
// When it unblocks, it iterates Stages in reverse order. For each stage it cancels
// it's context and waits for all started goroutines of that stage to finish.
// Then it proceeds to the next stage.
Run(ctx context.Context) error
}
Click to show internal directories.
Click to hide internal directories.