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 ¶
Types ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
func (*Filter) RequestHandler ¶
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)
Click to show internal directories.
Click to hide internal directories.