Documentation ¶
Overview ¶
This package contains a simple supervisor for goroutine workers.
Index ¶
Constants ¶
View Source
const DefaultSupervisorTimeout = time.Second * 15
Timeout when waiting for workers to finish.
View Source
const ServerPollInterval = 10 * time.Millisecond
Poll interval when checking whether the server is ready.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandWorker ¶
This worker is responsible for a shell command that runs endlessly.
func (CommandWorker) Start ¶
func (w CommandWorker) Start(ctx context.Context, ready chan<- struct{}) error
func (CommandWorker) String ¶
func (w CommandWorker) String() string
type HttpWorker ¶
The HTTP worker starts and manage an HTTP server.
func (HttpWorker) Start ¶
func (w HttpWorker) Start(ctx context.Context, ready chan<- struct{}) error
func (HttpWorker) String ¶
func (w HttpWorker) String() string
type ServerWorker ¶
type ServerWorker struct { CommandWorker Port int }
This worker is responsible for a shell command that runs endlessly. The worker polls the given port to know when it is ready.
type SupervisorWorker ¶
Start the workers in order, waiting for each one to be ready before starting the next one. When a worker exits, send a cancel signal to all of them and wait for them to finish.
func (SupervisorWorker) Start ¶
func (w SupervisorWorker) Start(ctx context.Context, ready chan<- struct{}) error
func (SupervisorWorker) String ¶
func (w SupervisorWorker) String() string
Click to show internal directories.
Click to hide internal directories.