runtime

package
v1.14.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: Apache-2.0 Imports: 14 Imported by: 3 modules, 14 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 ErrNoResponseFromBatchResponse = errors.New("processor hasn't received corresponding response for the event")
View Source
var RegistrySingleton = Registry{
	Registry: *registry.NewRegistry("runtime"),
}

global singleton

Functions

This section is empty.

Types

type AbstractRuntime

type AbstractRuntime struct {
	Logger         logger.Logger
	FunctionLogger logger.Logger
	Context        *nuclio.Context
	Statistics     Statistics
	// contains filtered or unexported fields
}

AbstractRuntime is the base for all runtimes

func NewAbstractRuntime

func NewAbstractRuntime(logger logger.Logger, configuration *Configuration) (*AbstractRuntime, error)

NewAbstractRuntime creates a new abstract runtime

func (*AbstractRuntime) Continue

func (ar *AbstractRuntime) Continue() error

func (*AbstractRuntime) Drain

func (ar *AbstractRuntime) Drain() error

func (*AbstractRuntime) GetConfiguration

func (ar *AbstractRuntime) GetConfiguration() *Configuration

GetConfiguration returns the runtime configuration

func (*AbstractRuntime) GetControlMessageBroker

func (ar *AbstractRuntime) GetControlMessageBroker() controlcommunication.ControlMessageBroker

GetControlMessageBroker returns the control message broker

func (*AbstractRuntime) GetEnvFromConfiguration

func (ar *AbstractRuntime) GetEnvFromConfiguration() []string

func (*AbstractRuntime) GetFunctionLogger

func (ar *AbstractRuntime) GetFunctionLogger() logger.Logger

GetFunctionLogger returns the function logger

func (*AbstractRuntime) GetStatistics

func (ar *AbstractRuntime) GetStatistics() *Statistics

GetStatistics returns statistics gathered by the runtime

func (*AbstractRuntime) GetStatus

func (ar *AbstractRuntime) GetStatus() status.Status

GetStatus returns the runtime's reported status

func (*AbstractRuntime) Restart

func (ar *AbstractRuntime) Restart() error

Restart restarts the runtime

func (*AbstractRuntime) SetStatus

func (ar *AbstractRuntime) SetStatus(newStatus status.Status)

SetStatus sets the runtime's reported status

func (*AbstractRuntime) Start

func (ar *AbstractRuntime) Start() error

Start starts the runtime, or does nothing if the runtime does not require starting (e.g. Go and shell runtimes)

func (*AbstractRuntime) Stop

func (ar *AbstractRuntime) Stop() error

Stop stops the runtime

func (*AbstractRuntime) SupportsControlCommunication

func (ar *AbstractRuntime) SupportsControlCommunication() bool

SupportsControlCommunication returns true if the runtime supports control communication

func (*AbstractRuntime) SupportsRestart

func (ar *AbstractRuntime) SupportsRestart() bool

SupportsRestart returns true if the runtime supports restart

func (*AbstractRuntime) Terminate

func (ar *AbstractRuntime) Terminate() error

type Configuration

type Configuration struct {
	*processor.Configuration
	FunctionLogger           logger.Logger
	WorkerID                 int
	TriggerName              string
	TriggerKind              string
	WorkerTerminationTimeout time.Duration
	ControlMessageBroker     *controlcommunication.AbstractControlMessageBroker
	Mode                     functionconfig.TriggerWorkMode
}

type Creator

type Creator interface {

	// Create creates a runtime instance
	Create(logger.Logger, *Configuration) (Runtime, error)
}

Creator creates a runtime instance

type Registry

type Registry struct {
	registry.Registry
}

func (*Registry) NewRuntime

func (r *Registry) NewRuntime(logger logger.Logger,
	kind string,
	runtimeConfiguration *Configuration) (Runtime, error)

type ResponseWithErrors

type ResponseWithErrors struct {
	nuclio.Response
	EventId         string
	SubmitError     error
	ProcessError    error
	NoResponseError error
}

type Runtime

type Runtime interface {

	// ProcessEvent receives the event and processes it at the specific runtime
	ProcessEvent(event nuclio.Event, functionLogger logger.Logger) (interface{}, error)

	// ProcessBatch receives the event batch and processes it at the specific runtime
	ProcessBatch(batch []nuclio.Event, functionLogger logger.Logger) ([]*ResponseWithErrors, error)

	// GetFunctionLogger returns the function logger
	GetFunctionLogger() logger.Logger

	// GetStatistics returns statistics gathered by the runtime
	GetStatistics() *Statistics

	// GetConfiguration returns the runtime configuration
	GetConfiguration() *Configuration

	// SetStatus sets the runtime's reported status
	SetStatus(newStatus status.Status)

	// GetStatus returns the runtime's reported status
	GetStatus() status.Status

	// Start starts the runtime, or does nothing if the runtime does not require starting (e.g. Go and shell runtimes)
	Start() error

	// Stop stops the runtime
	Stop() error

	// Restart restarts the runtime
	Restart() error

	// SupportsRestart return true if the runtime supports restart
	SupportsRestart() bool

	// Drain signals to the runtime process to drain its accumulated events and waits for it to finish
	Drain() error

	// Continue signals the runtime process to continue event processing
	Continue() error

	// Terminate signals to the runtime process that processor is about to stop working
	Terminate() error

	// GetControlMessageBroker returns the control message broker
	GetControlMessageBroker() controlcommunication.ControlMessageBroker
}

Runtime receives an event from a worker and passes it to a specific runtime like Golang, Python, et

type Statistics

type Statistics struct {
	DurationMilliSecondsSum   uint64
	DurationMilliSecondsCount uint64
}

func (*Statistics) DiffFrom

func (s *Statistics) DiffFrom(prev *Statistics) Statistics

Directories

Path Synopsis
test/_outputter command
Package java implements a Java runtime
Package java implements a Java runtime
Package nodejs implements nodejs runtime
Package nodejs implements nodejs runtime
rpc
Package rpc implmenets Python runtime
Package rpc implmenets Python runtime

Jump to

Keyboard shortcuts

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