api

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ABIContext

type ABIContext = api.ABIContext

type BinaryModule

type BinaryModule interface {
	Get() ([]byte, error)
}

type Closer

type Closer interface {
	Close()
}

type Context

type Context interface {
	PropertyHolder

	ID() int32
	NewContextID() int32
	GetOrCreateContext(rootID string) Context
}

type ContextHandler

type ContextHandler = api.ContextHandler

type DataSource

type DataSource interface {
	Get() ([]byte, error)
}

type FilterContext

type FilterContext interface {
	api.ContextHandler

	Logger() logr.Logger
	Lock()
	Unlock()
	Close() error
	ID() int32
	RootContext() Context
	GetABIContext() api.ContextHandler
}

type HTTPRequest

type HTTPRequest interface {
	URL() *url.URL
	Header() HeaderMap
	Trailer() HeaderMap
	Body() io.ReadCloser
	SetBody(io.ReadCloser)

	HTTPProtocol() string
	Host() string
	Method() string

	Connection() network.Connection
}

type HTTPResponse

type HTTPResponse interface {
	Header() HeaderMap
	Trailer() HeaderMap
	Body() io.ReadCloser
	SetBody(io.ReadCloser)

	Connection() network.Connection

	ContentLength() int64
	StatusCode() int
}

type HeaderMap

type HeaderMap interface {
	Get(key string) (string, bool)
	Set(key, value string)
	Add(key, value string)
	Del(key string)
	Keys() []string
	Len() int
	Raw() map[string][]string
	Clone() HeaderMap
}

type IoBuffer

type IoBuffer = api.IoBuffer

type JsonnableMap

type JsonnableMap map[string]interface{}

func (JsonnableMap) Marshal

func (m JsonnableMap) Marshal() ([]byte, error)

type ListenerDirection

type ListenerDirection uint64
const (
	ListenerDirectionUnspecified ListenerDirection = iota
	ListenerDirectionInbound
	ListenerDirectionOutbound
)

type Marshallable

type Marshallable interface {
	Marshal() ([]byte, error)
}

type MetricHandler

type MetricHandler interface {
	HTTPHandler() http.Handler
	DefineMetric(metricType int32, name string) int32
	RecordMetric(metricID int32, value int64) error
	IncrementMetric(metricID int32, offset int64) error
}

type PropertyHolder

type PropertyHolder interface {
	Get(key string) (interface{}, bool)
	Set(key string, value interface{})
}

type RuntimeCreatorStore

type RuntimeCreatorStore interface {
	Get(name string) (WasmRuntimeCreator, bool)
	Set(name string, creator WasmRuntimeCreator)
}

type Stream

type Stream interface {
	PropertyHolder

	Logger() logr.Logger
	Close() error
	Direction() ListenerDirection

	HandleHTTPRequest(req HTTPRequest) error
	HandleHTTPResponse(resp HTTPResponse) error

	HandleTCPNewConnection(conn net.Conn) error
	HandleTCPCloseConnection(conn net.Conn) error
	HandleDownstreamData(conn net.Conn, n int) error
	HandleUpstreamData(conn net.Conn, n int) error
}

type StreamHandler

type StreamHandler interface {
	NewStream(direction ListenerDirection, options ...StreamOption) (Stream, error)
	Logger() logr.Logger
}

type StreamOption

type StreamOption func(instance interface{})

type VMKey

type VMKey string

type VMStore

type VMStore interface {
	GetOrCreateVM(vmConfig WasmVMConfig) (WasmVM, error)
}

type WasmInstance

type WasmInstance = api.WasmInstance

type WasmInstanceContext

type WasmInstanceContext interface {
	GetInstance() WasmInstance
	GetProperties() PropertyHolder
	GetABIContext() ContextHandler
}

type WasmModule

type WasmModule = api.WasmModule

type WasmPlugin

type WasmPlugin interface {
	Name() string
	ID() string
	GetInstance() (WasmInstance, error)
	ReleaseInstance(instance WasmInstance)
	EnsureInstances(desired uint32) uint32
	Exec(f func(instance WasmInstance) bool)
	Close()
	Report()
	VM() WasmVM
	Context() Context
	Logger() logr.Logger

	RegisterFilterContext(instance WasmInstance, filterContext FilterContext)
	UnregisterFilterContext(instance WasmInstance, filterContext FilterContext)
	GetFilterContext(instance WasmInstance, id int32) (FilterContext, bool)

	GetWasmInstanceContext(instance WasmInstance) WasmInstanceContext
}

type WasmPluginConfig

type WasmPluginConfig struct {
	Name          string       `json:"name,omitempty"`
	RootID        string       `json:"rootID,omitempty"`
	VMConfig      WasmVMConfig `json:"vmConfig,omitempty"`
	Configuration Marshallable `json:"configuration,omitempty"`
	InstanceCount uint32       `json:"instanceCount,omitempty"`
}

func (*WasmPluginConfig) Key

func (c *WasmPluginConfig) Key() string

type WasmPluginManager

type WasmPluginManager interface {
	Delete(config WasmPluginConfig) error
	Get(config WasmPluginConfig) (WasmPlugin, error)
	GetOrCreate(config WasmPluginConfig) (WasmPlugin, error)
	Add(config WasmPluginConfig) (WasmPlugin, error)
	Logger() logr.Logger
	GetBaseContext() Context
}

type WasmResult

type WasmResult = api.WasmResult

type WasmRuntime

type WasmRuntime interface {
	Name() string
	Init()
	NewModule(wasmBytes []byte) (WasmModule, error)
}

type WasmRuntimeCreator

type WasmRuntimeCreator func() WasmRuntime

type WasmVM

type WasmVM interface {
	WasmRuntime
	Acquire(user interface{})
	Release(user interface{})
	Close()
}

type WasmVMConfig

type WasmVMConfig struct {
	ID            string                 `json:"id,omitempty"`
	Runtime       string                 `json:"runtime,omitempty"`
	Code          DataSource             `json:"code,omitempty"`
	Configuration map[string]interface{} `json:"configuration,omitempty"`
}

func (*WasmVMConfig) GetVMKey

func (c *WasmVMConfig) GetVMKey() (VMKey, error)

type WrappedPropertyHolder

type WrappedPropertyHolder interface {
	PropertyHolder
	Properties() PropertyHolder
	ParentProperties() PropertyHolder
}

Jump to

Keyboard shortcuts

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