Documentation ¶
Index ¶
- Constants
- type Options
- type PExec
- type Pool
- func (sp *Pool) AddWorker() error
- func (sp *Pool) Destroy(ctx context.Context)
- func (sp *Pool) Exec(ctx context.Context, p *payload.Payload, stopCh chan struct{}) (chan *PExec, error)
- func (sp *Pool) GetConfig() *pool.Config
- func (sp *Pool) QueueSize() uint64
- func (sp *Pool) RemoveWorker(ctx context.Context) error
- func (sp *Pool) Reset(ctx context.Context) error
- func (sp *Pool) Start()
- func (sp *Pool) Stop()
- func (sp *Pool) Workers() (workers []*worker.Process)
Constants ¶
View Source
const ( MB = 1024 * 1024 // NsecInSec nanoseconds in second NsecInSec int64 = 1000000000 )
View Source
const (
// StopRequest can be sent by worker to indicate that restart is required.
StopRequest = `{"stop":true}`
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool controls worker creation, destruction and task routing. Pool uses fixed amount of stack.
func NewPool ¶
func NewPool(ctx context.Context, cmd pool.Command, factory pool.Factory, cfg *pool.Config, log *zap.Logger, options ...Options) (*Pool, error)
NewPool creates a new worker pool and task multiplexer. Pool will initiate with one worker. If supervisor configuration is provided -> pool will be turned into a supervisedExec mode
func (*Pool) Exec ¶
func (sp *Pool) Exec(ctx context.Context, p *payload.Payload, stopCh chan struct{}) (chan *PExec, error)
Exec executes provided payload on the worker
Click to show internal directories.
Click to hide internal directories.