bfe_wasmplugin

package
v1.8.9-preview.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 20 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEngineNotFound     = errors.New("fail to get wasm engine")
	ErrWasmBytesLoad      = errors.New("fail to load wasm bytes")
	ErrWasmBytesIncorrect = errors.New("incorrect hash of wasm bytes")
	ErrConfigFileLoad     = errors.New("fail to load config file")
	ErrMd5FileLoad        = errors.New("fail to load md5 file")
	ErrInstanceCreate     = errors.New("fail to create wasm instance")
	ErrModuleCreate       = errors.New("fail to create wasm module")
)

Functions

func GetWasmEngine

func GetWasmEngine() common.WasmVM

Types

type Filter

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

func NewFilter

func NewFilter(plugin WasmPlugin, request *bfe_basic.Request) *Filter

func (*Filter) OnDestroy

func (f *Filter) OnDestroy()

func (*Filter) RequestHandler

func (f *Filter) RequestHandler(request *bfe_basic.Request) (int, *bfe_http.Response)

func (*Filter) ResponseHandler

func (f *Filter) ResponseHandler(request *bfe_basic.Request) (int, *bfe_http.Response)

type WasmPlugin

type WasmPlugin interface {
	// PluginName returns the name of wasm plugin
	PluginName() string

	// GetPluginConfig returns the config of wasm plugin
	GetPluginConfig() []byte

	// GetPluginConfig returns the config of wasm plugin
	GetConfig() WasmPluginConfig

	// EnsureInstanceNum tries to expand/shrink the num of instance to 'num'
	// and returns the actual instance num
	EnsureInstanceNum(num int) int

	// InstanceNum returns the current number of wasm instance
	InstanceNum() int

	// GetInstance returns one plugin instance of the plugin
	GetInstance() common.WasmInstance

	// ReleaseInstance releases the instance to the plugin
	ReleaseInstance(instance common.WasmInstance)

	// Exec execute the f for each instance
	Exec(f func(instance common.WasmInstance) bool)

	// Clear got called when the plugin is destroyed
	Clear()

	// OnPluginStart got called when starting the wasm plugin
	OnPluginStart()

	// OnPluginDestroy got called when destroying the wasm plugin
	OnPluginDestroy()

	GetRootContextID() int32
}

WasmPlugin manages the collection of wasm plugin instances

func NewWasmPlugin

func NewWasmPlugin(wasmConfig WasmPluginConfig) (WasmPlugin, error)

type WasmPluginConfig

type WasmPluginConfig struct {
	PluginName    string `json:"plugin_name,omitempty"`
	Path          string `json:"path,omitempty"`
	Md5           string `json:"md5,omitempty"`
	WasmVersion   string
	ConfigVersion string
	InstanceNum   int `json:"instance_num,omitempty"`
}

Directories

Path Synopsis
abi

Jump to

Keyboard shortcuts

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