runtime

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package runtime implements the Scale Runtime in Go.

Index

Constants

This section is empty.

Variables

View Source
var (
	NoFunctionsError = errors.New("no functions found in runtime")
)

Functions

This section is empty.

Types

type Function

type Function[T signature.Signature] struct {
	// contains filtered or unexported fields
}

Function is the runtime representation of a scale function.

func (*Function[T]) Run

func (f *Function[T]) Run(ctx context.Context, i *Instance[T]) error

type Instance

type Instance[T signature.Signature] struct {
	// contains filtered or unexported fields
}

func (*Instance[T]) Context

func (i *Instance[T]) Context() T

func (*Instance[T]) Run

func (i *Instance[T]) Run(ctx context.Context) error

type Module

type Module[T signature.Signature] struct {
	// contains filtered or unexported fields
}

func NewModule

func NewModule[T signature.Signature](ctx context.Context, f *Function[T], r *Runtime[T]) (*Module[T], error)

type Next

type Next[T signature.Signature] func(ctx T) (T, error)

Next is the next function in the middleware chain. It's meant to be implemented by whatever adapter is being used.

type Pool

type Pool[T signature.Signature] struct {
	// contains filtered or unexported fields
}

func NewPool

func NewPool[T signature.Signature](ctx context.Context, f *Function[T], r *Runtime[T]) *Pool[T]

func (*Pool[T]) Get

func (p *Pool[T]) Get() (*Module[T], error)

func (*Pool[T]) Put

func (p *Pool[T]) Put(module *Module[T])

type Runtime

type Runtime[T signature.Signature] struct {
	// contains filtered or unexported fields
}

Runtime is the Scale Runtime. It is responsible for initializing and managing the WASM runtime as well as the scale function chain.

func New

func New(ctx context.Context, functions []*scalefunc.ScaleFunc) (*Runtime[*httpSignature.Context], error)

func NewWithSignature added in v0.2.0

func NewWithSignature[T signature.Signature](ctx context.Context, sig signature.NewSignature[T], functions []*scalefunc.ScaleFunc) (*Runtime[T], error)

func (*Runtime[T]) Instance

func (r *Runtime[T]) Instance(next ...Next[T]) (*Instance[T], error)

Directories

Path Synopsis
Package storage is used to store and retrieve built Scale Functions
Package storage is used to store and retrieve built Scale Functions
tests

Jump to

Keyboard shortcuts

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