Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrClosed = errors.New("worker closed")
)
Functions ¶
This section is empty.
Types ¶
type DefaultPool ¶
type DefaultPool struct {
// contains filtered or unexported fields
}
func (*DefaultPool) Close ¶
func (p *DefaultPool) Close() (err error)
func (*DefaultPool) GetWorker ¶
func (p *DefaultPool) GetWorker(ctx context.Context) (Worker, error)
func (*DefaultPool) ReturnWorker ¶
func (p *DefaultPool) ReturnWorker(worker Worker)
type DefaultWorkQueue ¶
type DefaultWorkQueue struct {
// contains filtered or unexported fields
}
func (*DefaultWorkQueue) Add ¶
func (q *DefaultWorkQueue) Add(info WorkInfo)
func (*DefaultWorkQueue) GetMaxSize ¶
func (q *DefaultWorkQueue) GetMaxSize() int
func (*DefaultWorkQueue) SetMaxSize ¶
func (q *DefaultWorkQueue) SetMaxSize(size int)
func (*DefaultWorkQueue) Wait ¶
func (q *DefaultWorkQueue) Wait()
type GenericWorkInfo ¶
type GenericWorkInfo[T, U any] struct { Ctx context.Context Request T Result chan U Err chan error Run WorkRunFunc[T, U] }
func NewWorkInfo ¶
func NewWorkInfo[T, U any](ctx context.Context, request T, runFunc WorkRunFunc[T, U]) *GenericWorkInfo[T, U]
type Pool ¶
type ReadyOptions ¶
type ReadyOptionsFunc ¶
type ReadyOptionsFunc func(options *ReadyOptions)
func WithConnTimeout ¶
func WithConnTimeout(timeout time.Duration) ReadyOptionsFunc
func WithTickerInterval ¶
func WithTickerInterval(interval time.Duration) ReadyOptionsFunc
type WorkQueue ¶
type WorkRunFunc ¶
type Worker ¶
type Worker interface { io.Closer Equals(other Worker) bool Connect(ctx context.Context) error Worker() proto.WorkerServiceClient Job() proto.JobServiceClient IsReady(ctx context.Context, opts ...ReadyOptionsFunc) (bool, error) IsReadyChan(ctx context.Context, opts ...ReadyOptionsFunc) <-chan error }
Click to show internal directories.
Click to hide internal directories.