module

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: Apache-2.0 Imports: 14 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewError

func NewError(err error) error

func ToMessage

func ToMessage(functionContext *pbtypes.FunctionContext) (message statefun.MessageBuilder, err error)

Types

type Context

type Context interface {
	statefun.Context
	Message() json.RawMessage
	States() []statefun.ValueSpec

	CmdbContext() json.RawMessage
}

type Module

type Module interface {
	// Bind new function to module
	Bind(string, StatefulFunction, ...statefun.ValueSpec) error

	// RegisterAndListen register module and listen port
	RegisterAndListen(context.Context) error

	// listener port
	Port() int
	// addr for register
	Addr() string
}

func New

func New(namespace string, opts ...Opt) Module

type Opt

type Opt func(*module)

func WithPort

func WithPort(port int) Opt

func WithStatefulFunctions

func WithStatefulFunctions(builder statefun.StatefulFunctions) Opt

type StatefulFunction

type StatefulFunction func(Context) error

StatefulFunction function interface

Jump to

Keyboard shortcuts

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