Documentation
¶
Index ¶
- Variables
- func WithMaxConcurrentTasksLimit(limit int) func(*WorkerOptions)
- func WithPollerBackoffMultiplier(multiplier float64) func(*WorkerOptions)
- func WithPollerInitialBackoffInterval(duration time.Duration) func(*WorkerOptions)
- func WithPollerMaxBackoffInterval(duration time.Duration) func(*WorkerOptions)
- type Summarizer
- type TaskProcessor
- type Worker
- type WorkerOptions
- type WorkerThread
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoTask = errors.New("no task found")
View Source
var SuppressedError = errors.New("suppressed error")
Functions ¶
func WithMaxConcurrentTasksLimit ¶
func WithMaxConcurrentTasksLimit(limit int) func(*WorkerOptions)
func WithPollerBackoffMultiplier ¶
func WithPollerBackoffMultiplier(multiplier float64) func(*WorkerOptions)
func WithPollerInitialBackoffInterval ¶
func WithPollerInitialBackoffInterval(duration time.Duration) func(*WorkerOptions)
func WithPollerMaxBackoffInterval ¶
func WithPollerMaxBackoffInterval(duration time.Duration) func(*WorkerOptions)
Types ¶
type Summarizer ¶
type Summarizer interface {
Summary() any
}
type TaskProcessor ¶
type Worker ¶
type Worker[T Summarizer, R Summarizer] interface { Start(ctx context.Context) Stop(ctx context.Context) }
func NewWorker ¶
func NewWorker[T Summarizer, R Summarizer]( name string, taskProcessor TaskProcessor[T, R], logger *zap.Logger, options *WorkerOptions, ) Worker[T, R]
func NewWorkerOpts ¶
func NewWorkerOpts[T Summarizer, R Summarizer]( name string, taskProcessor TaskProcessor[T, R], logger *zap.Logger, opts ...func(*WorkerOptions), ) Worker[T, R]
type WorkerOptions ¶
type WorkerOptions struct {
MaxConcurrentTasksLimit int
PollerInitialBackoffInterval time.Duration
PollerMaxBackoffInterval time.Duration
PollerBackoffMultiplier float64
}
func NewWorkerOptions ¶
func NewWorkerOptions() *WorkerOptions
type WorkerThread ¶
type WorkerThread[T Summarizer, R Summarizer] struct { // contains filtered or unexported fields }
func NewWorkerThread ¶
func NewWorkerThread[T Summarizer, R Summarizer]( name string, taskProcessor TaskProcessor[T, R], bo backoff.Backoff, wg *sync.WaitGroup, logger *zap.Logger, ) *WorkerThread[T, R]
func (*WorkerThread[T, R]) Run ¶
func (w *WorkerThread[T, R]) Run(ctx context.Context)
Click to show internal directories.
Click to hide internal directories.