Versions in this module Expand all Collapse all v0 v0.2.0 Apr 28, 2022 Changes in this version + var ErrClosed = errors.New("worker closed") + type DefaultPool struct + func (p *DefaultPool) Close() (err error) + func (p *DefaultPool) GetWorker(ctx context.Context) (Worker, error) + func (p *DefaultPool) ReturnWorker(worker Worker) + type DefaultWorkQueue struct + func (q *DefaultWorkQueue) Add(info WorkInfo) + func (q *DefaultWorkQueue) GetMaxSize() int + func (q *DefaultWorkQueue) SetMaxSize(size int) + func (q *DefaultWorkQueue) Wait() + type GenericWorkInfo struct + Ctx context.Context + Err chan error + Request T + Result chan U + Run WorkRunFunc[T, U] + func NewWorkInfo(ctx context.Context, request T, runFunc WorkRunFunc[T, U]) *GenericWorkInfo[T, U] + type Pool interface + GetWorker func(ctx context.Context) (Worker, error) + ReturnWorker func(worker Worker) + func NewPool(logger *zap.Logger, factory WorkerFactory) Pool + type ReadyOptions struct + ConnTimeout time.Duration + TickerInterval time.Duration + type ReadyOptionsFunc func(options *ReadyOptions) + func WithConnTimeout(timeout time.Duration) ReadyOptionsFunc + func WithTickerInterval(interval time.Duration) ReadyOptionsFunc + type WorkInfo interface + type WorkQueue interface + Add func(info WorkInfo) + GetMaxSize func() int + SetMaxSize func(size int) + Wait func() + func NewQueue(logger *zap.Logger, pool Pool, maxSize int) WorkQueue + type WorkRunFunc func(ctx context.Context, logger *zap.Logger, req T, instance Worker) (U, error) + type Worker interface + Connect func(ctx context.Context) error + Equals func(other Worker) bool + IsReady func(ctx context.Context, opts ...ReadyOptionsFunc) (bool, error) + IsReadyChan func(ctx context.Context, opts ...ReadyOptionsFunc) <-chan error + Job func() proto.JobServiceClient + Worker func() proto.WorkerServiceClient + type WorkerFactory interface + Create func(ctx context.Context) (Worker, error)