worker

package
v0.0.0-...-2f10389 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2017 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoAvailableWorkers = errors.New("No available workers")

errors

View Source
var WorkerFactorySingleton = Factory{}

global singleton

Functions

This section is empty.

Types

type Allocator

type Allocator interface {

	// allocate a worker
	Allocate(timeout time.Duration) (*Worker, error)

	// release a worker
	Release(worker *Worker)

	// true if the several go routines can share this allocator
	Shareable() bool

	// get direct access to all workers for things like management / housekeeping
	GetWorkers() []*Worker
}

func NewFixedPoolWorkerAllocator

func NewFixedPoolWorkerAllocator(parentLogger nuclio.Logger, workers []*Worker) (Allocator, error)

func NewSingletonWorkerAllocator

func NewSingletonWorkerAllocator(parentLogger nuclio.Logger, worker *Worker) (Allocator, error)

type Factory

type Factory struct{}

func (*Factory) CreateFixedPoolWorkerAllocator

func (waf *Factory) CreateFixedPoolWorkerAllocator(logger nuclio.Logger,
	numWorkers int,
	runtimeConfiguration *viper.Viper) (Allocator, error)

func (*Factory) CreateSingletonPoolWorkerAllocator

func (waf *Factory) CreateSingletonPoolWorkerAllocator(logger nuclio.Logger,
	runtimeConfiguration *viper.Viper) (Allocator, error)

type Statistics

type Statistics struct {
	EventsHandleSuccess uint64
	EventsHandleError   uint64
}

type Worker

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

func NewWorker

func NewWorker(parentLogger nuclio.Logger,
	index int,
	runtime runtime.Runtime) (*Worker, error)

func (*Worker) GetIndex

func (w *Worker) GetIndex() int

func (*Worker) GetRuntime

func (w *Worker) GetRuntime() runtime.Runtime

func (*Worker) GetStatistics

func (w *Worker) GetStatistics() *Statistics

func (*Worker) ProcessEvent

func (w *Worker) ProcessEvent(event nuclio.Event, functionLogger nuclio.Logger) (interface{}, error)

called by event sources

Jump to

Keyboard shortcuts

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