Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrManagerAlreadyClosed = errors.New("runner manager already closed")
)
var ErrManagerAlreadyStarted = errors.New("runner manager already started")
Functions ¶
This section is empty.
Types ¶
type RunnerCloserManager ¶
type RunnerCloserManager struct {
// contains filtered or unexported fields
}
RunnerCloserManager is a RunnerManager that also implements Closing of the added closers once the main runners are done.
func NewRunnerCloserManager ¶
func NewRunnerCloserManager(gracePeriod *time.Duration, runners ...Runner) *RunnerCloserManager
NewRunnerCloserManager creates a new RunnerCloserManager with the given grace period and runners. If gracePeriod is nil, the grace period is infinite.
func (*RunnerCloserManager) Add ¶
func (c *RunnerCloserManager) Add(runner ...Runner) error
Add implements RunnerManager.Add.
func (*RunnerCloserManager) AddCloser ¶
func (c *RunnerCloserManager) AddCloser(closers ...any) error
AddCloser adds a closer to the list of closers to be closed once the main runners are done.
func (*RunnerCloserManager) Close ¶
func (c *RunnerCloserManager) Close() error
Close will close the main runners and then the closers.
func (*RunnerCloserManager) Run ¶
func (c *RunnerCloserManager) Run(ctx context.Context) error
Add implements RunnerManager.Run.
func (*RunnerCloserManager) WaitUntilShutdown ¶
func (c *RunnerCloserManager) WaitUntilShutdown()
WaitUntilShutdown will block until the main runners and closers are done.
type RunnerManager ¶
type RunnerManager struct {
// contains filtered or unexported fields
}
RunnerManager is a manager for runners. It runs all runners in parallel and waits for all runners to finish. If any runner returns, the RunnerManager will stop all other runners and return any error.
func NewRunnerManager ¶
func NewRunnerManager(runners ...Runner) *RunnerManager
NewRunnerManager creates a new RunnerManager.
func (*RunnerManager) Add ¶
func (r *RunnerManager) Add(runner ...Runner) error
Add adds a new runner to the RunnerManager.