worker

package
v0.0.0-...-1327151 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2020 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package worker implements worker node iteraction with the coordinator server.

Index

Constants

This section is empty.

Variables

View Source
var DefaultPollingConfig = PollingConfig{
	Initial:    time.Second,
	Multiplier: 1.5,
	Max:        time.Minute,
}

Functions

This section is empty.

Types

type Option

type Option func(*Worker)

func WithLogger

func WithLogger(l *zap.Logger) Option

func WithPollingConfig

func WithPollingConfig(poll PollingConfig) Option

type PollingConfig

type PollingConfig struct {
	Initial    time.Duration
	Multiplier float64
	Max        time.Duration
}

func (PollingConfig) Next

type Processor

type Processor interface {
	Process(context.Context, *coordinator.Job) (io.ReadCloser, error)
}

Processor executes jobs, returning the output file.

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

func New

func New(c *coordinator.Client, p Processor, opts ...Option) *Worker

func (*Worker) Run

func (w *Worker) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL