Versions in this module Expand all Collapse all v1 v1.14.2 Feb 25, 2025 Changes in this version + var ErrAllWorkersAreTerminated = errors.New("All workers are terminated") + var ErrNoAvailableWorkers = errors.New("No available workers") + var WorkerFactorySingleton = Factory + type Allocator interface + Allocate func(timeout time.Duration) (*Worker, error) + GetNumWorkersAvailable func() int + GetStatistics func() *AllocatorStatistics + GetWorkers func() []*Worker + IsTerminated func() bool + Release func(worker *Worker) + Shareable func() bool + SignalContinue func() error + SignalDraining func() error + SignalTermination func() error + func NewFixedPoolWorkerAllocator(parentLogger logger.Logger, workers []*Worker) (Allocator, error) + func NewSingletonWorkerAllocator(parentLogger logger.Logger, worker *Worker) (Allocator, error) + type AllocatorStatistics struct + WorkerAllocationCount uint64 + WorkerAllocationSuccessAfterWaitTotal uint64 + WorkerAllocationSuccessImmediateTotal uint64 + WorkerAllocationTimeoutTotal uint64 + WorkerAllocationWaitDurationMilliSecondsSum uint64 + WorkerAllocationWorkersAvailablePercentage uint64 + func (s *AllocatorStatistics) DiffFrom(prev *AllocatorStatistics) AllocatorStatistics + type AllocatorSyncMap struct + func NewAllocatorSyncMap() *AllocatorSyncMap + func (w *AllocatorSyncMap) Delete(key string) + func (w *AllocatorSyncMap) Keys() []string + func (w *AllocatorSyncMap) Load(key string) (Allocator, bool) + func (w *AllocatorSyncMap) LoadOrStore(key string, workerAllocatorCreator func() (Allocator, error)) (Allocator, error) + func (w *AllocatorSyncMap) Range(handler func(string, Allocator) bool) + func (w *AllocatorSyncMap) Store(key string, value Allocator) + type Factory struct + func (waf *Factory) CreateFixedPoolWorkerAllocator(logger logger.Logger, numWorkers int, ...) (Allocator, error) + func (waf *Factory) CreateSingletonPoolWorkerAllocator(logger logger.Logger, runtimeConfiguration *runtime.Configuration) (Allocator, error) + type Statistics struct + EventsHandledError uint64 + EventsHandledSuccess uint64 + type Worker struct + func NewWorker(parentLogger logger.Logger, index int, runtime runtime.Runtime) (*Worker, error) + func (w *Worker) Continue() error + func (w *Worker) Drain() error + func (w *Worker) GetBinaryCloudEvent() *cloudevent.Binary + func (w *Worker) GetEventTime() *time.Time + func (w *Worker) GetIndex() int + func (w *Worker) GetRuntime() runtime.Runtime + func (w *Worker) GetStatistics() *Statistics + func (w *Worker) GetStatus() status.Status + func (w *Worker) GetStructuredCloudEvent() *cloudevent.Structured + func (w *Worker) ProcessEvent(event nuclio.Event, functionLogger logger.Logger) (interface{}, error) + func (w *Worker) ProcessEventBatch(batch []nuclio.Event) ([]*runtime.ResponseWithErrors, error) + func (w *Worker) ResetEventTime() + func (w *Worker) Restart() error + func (w *Worker) Stop() error + func (w *Worker) Subscribe(kind controlcommunication.ControlMessageKind, ...) error + func (w *Worker) SupportsRestart() bool + func (w *Worker) Terminate() error + func (w *Worker) Unsubscribe(kind controlcommunication.ControlMessageKind, ...) error