runtime

package
v0.0.0-...-4237827 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: Apache-2.0 Imports: 12 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

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
	ControlMessageBroker controlcommunication.ControlMessageBroker
	// 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
}

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 Runtime

type Runtime interface {

	// ProcessEvent receives the event and processes it at the specific runtime
	ProcessEvent(event nuclio.Event, functionLogger logger.Logger) (interface{}, 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
Package java implements a Java runtime
Package java implements a Java runtime
Package nodejs implements nodejs runtime
Package nodejs implements nodejs runtime
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