rpc

package
v0.0.0-...-c2794ed Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package rpc implmenets Python runtime

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRpcControlMessageBroker

func NewRpcControlMessageBroker(encoder EventEncoder, logger logger.Logger, abstractControlMessageBroker *controlcommunication.AbstractControlMessageBroker) *rpcControlMessageBroker

NewRpcControlMessageBroker creates a new RPC control message broker

Types

type AbstractRuntime

type AbstractRuntime struct {
	runtime.AbstractRuntime
	// contains filtered or unexported fields
}

AbstractRuntime is a runtime that communicates via unix domain socket

func NewAbstractRuntime

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

NewAbstractRuntime returns a new RPC runtime

func (*AbstractRuntime) Continue

func (r *AbstractRuntime) Continue() error

Continue signals the runtime to continue event processing

func (*AbstractRuntime) Drain

func (r *AbstractRuntime) Drain() error

Drain signals to the runtime to drain its accumulated events and waits for it to finish

func (*AbstractRuntime) GetSocketType

func (r *AbstractRuntime) GetSocketType() SocketType

GetSocketType returns the type of socket the runtime works with (unix/tcp)

func (*AbstractRuntime) ProcessEvent

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

ProcessEvent processes an event

func (*AbstractRuntime) Restart

func (r *AbstractRuntime) Restart() error

Restart restarts the runtime

func (*AbstractRuntime) Start

func (r *AbstractRuntime) Start() error

func (*AbstractRuntime) Stop

func (r *AbstractRuntime) Stop() error

Stop stops the runtime

func (*AbstractRuntime) SupportsControlCommunication

func (r *AbstractRuntime) SupportsControlCommunication() bool

SupportsControlCommunication returns true if the runtime supports control communication

func (*AbstractRuntime) SupportsRestart

func (r *AbstractRuntime) SupportsRestart() bool

SupportsRestart returns true if the runtime supports restart

func (*AbstractRuntime) Terminate

func (r *AbstractRuntime) Terminate() error

Terminate signals to the runtime process that processor is about to stop working

func (*AbstractRuntime) WaitForStart

func (r *AbstractRuntime) WaitForStart() bool

WaitForStart returns whether the runtime supports sending an indication that it started

type EventEncoder

type EventEncoder interface {
	Encode(event nuclio.Event) error
}

type EventJSONEncoder

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

EventJSONEncoder encodes nuclio events as JSON

func NewEventJSONEncoder

func NewEventJSONEncoder(logger logger.Logger, writer io.Writer) *EventJSONEncoder

NewEventJSONEncoder returns a new JSONEncoder

func (*EventJSONEncoder) Encode

func (e *EventJSONEncoder) Encode(event nuclio.Event) error

Encode writes the JSON encoding of event to the stream, followed by a newline character

type EventMsgPackEncoder

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

EventMsgPackEncoder encodes nuclio events as MsgPack

func NewEventMsgPackEncoder

func NewEventMsgPackEncoder(logger logger.Logger, writer io.Writer) *EventMsgPackEncoder

NewEventMsgPackEncoder returns a new MsgPackEncoder

func (*EventMsgPackEncoder) Encode

func (e *EventMsgPackEncoder) Encode(event nuclio.Event) error

Encode writes the JSON encoding of event to the stream, followed by a newline character

type Runtime

type Runtime interface {

	// RunWrapper runs the wrapper
	RunWrapper(string, string) (*os.Process, error)

	// GetSocketType returns the type of socket the runtime works with (unix/tcp)
	GetSocketType() SocketType

	GetEventEncoder(writer io.Writer) EventEncoder

	// WaitForStart returns whether the runtime supports sending an indication that it started
	WaitForStart() bool

	// SupportsControlCommunication returns true if the runtime supports control communication
	SupportsControlCommunication() bool
}

type SocketType

type SocketType int

SocketType is type of socket to use

const (
	UnixSocket SocketType = iota
	TCPSocket
)

RPC socket types

Jump to

Keyboard shortcuts

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