worker

package
v0.0.0-...-c008544 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2025 License: Apache-2.0 Imports: 16 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WorkerFactorySingleton = Factory{}

global singleton

Functions

func NewWorker

func NewWorker(parentLogger logger.Logger,
	index int,
	runtime runtime.Runtime) (eventprocessor.EventProcessor, error)

NewWorker creates a new worker

Types

type Factory

type Factory struct{}

func (*Factory) CreateAsyncSingletonPoolWorkerAllocator

func (waf *Factory) CreateAsyncSingletonPoolWorkerAllocator(logger logger.Logger,
	runtimeConfiguration *runtime.Configuration) (eventprocessor.Allocator, error)

func (*Factory) CreateFixedPoolWorkerAllocator

func (waf *Factory) CreateFixedPoolWorkerAllocator(logger logger.Logger,
	numWorkers int,
	runtimeConfiguration *runtime.Configuration) (eventprocessor.Allocator, error)

type Worker

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

Worker holds all the required state and context to handle a single request

func (*Worker) Continue

func (w *Worker) Continue() error

func (*Worker) Drain

func (w *Worker) Drain() error

func (*Worker) GetBinaryCloudEvent

func (w *Worker) GetBinaryCloudEvent() *cloudevent.Binary

GetBinaryCloudEvent return a binary cloud event

func (*Worker) GetEventTime

func (w *Worker) GetEventTime() *time.Time

GetEventTime return current event time, nil if we're not handling event

func (*Worker) GetIndex

func (w *Worker) GetIndex() int

GetIndex returns the index of the worker, as specified during creation

func (*Worker) GetRuntime

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

GetRuntime returns the runtime of the worker, as specified during creation

func (*Worker) GetStatistics

func (w *Worker) GetStatistics() *eventprocessor.Statistics

GetStatistics returns a pointer to the statistics object. This must not be modified by the reader

func (*Worker) GetStatus

func (w *Worker) GetStatus() status.Status

GetStatus returns the status of the worker, as updated by the runtime

func (*Worker) GetStructuredCloudEvent

func (w *Worker) GetStructuredCloudEvent() *cloudevent.Structured

GetStructuredCloudEvent return a structued clould event

func (*Worker) ProcessEvent

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

ProcessEvent sends the event to the associated runtime

func (*Worker) ProcessEventBatch

func (w *Worker) ProcessEventBatch(batch []nuclio.Event, functionLogger logger.Logger) ([]*runtime.ResponseWithErrors, error)

func (*Worker) ResetEventTime

func (w *Worker) ResetEventTime()

ResetEventTime resets the event time

func (*Worker) Restart

func (w *Worker) Restart() error

Restart restarts the worker

func (*Worker) RunHandler

func (w *Worker) RunHandler()

func (*Worker) Stop

func (w *Worker) Stop() error

Stop stops the worker and associated runtime

func (*Worker) Subscribe

Subscribe subscribes to a control message kind

func (*Worker) SupportsRestart

func (w *Worker) SupportsRestart() bool

SupportsRestart returns true if the underlying runtime supports restart

func (*Worker) Terminate

func (w *Worker) Terminate() error

func (*Worker) Unsubscribe

Unsubscribe unsubscribes from a control message kind

func (*Worker) WaitForStart

func (w *Worker) WaitForStart()

Jump to

Keyboard shortcuts

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