Documentation ¶
Index ¶
- func ExtismVersion() string
- func SetLogFile(filename string, level string) bool
- func ValGetF32(v unsafe.Pointer) float32
- func ValGetF64(v unsafe.Pointer) float64
- func ValGetI32(v unsafe.Pointer) int32
- func ValGetI64(v unsafe.Pointer) int64
- func ValGetUInt(v unsafe.Pointer) uint
- func ValSetF32(v unsafe.Pointer, i float32)
- func ValSetF64(v unsafe.Pointer, f float64)
- func ValSetI32(v unsafe.Pointer, i int32)
- func ValSetI64(v unsafe.Pointer, i int64)
- type CancelHandle
- type Context
- type CurrentPlugin
- func (p *CurrentPlugin) Alloc(n uint) uint
- func (p *CurrentPlugin) Free(offs uint)
- func (p *CurrentPlugin) InputBytes(v unsafe.Pointer) []byte
- func (p *CurrentPlugin) InputString(v unsafe.Pointer) string
- func (p *CurrentPlugin) Length(offs uint) uint
- func (p *CurrentPlugin) Memory(offs uint) []byte
- func (p *CurrentPlugin) ReturnBytes(v unsafe.Pointer, b []byte)
- func (p *CurrentPlugin) ReturnString(v unsafe.Pointer, s string)
- type Function
- type Manifest
- type Plugin
- func (plugin Plugin) Call(functionName string, input []byte) ([]byte, error)
- func (p *Plugin) CancelHandle() CancelHandle
- func (plugin *Plugin) Free()
- func (plugin Plugin) FunctionExists(functionName string) bool
- func (plugin Plugin) SetConfig(data map[string][]byte) error
- func (p *Plugin) Update(module io.Reader, functions []Function, wasi bool) error
- func (p *Plugin) UpdateManifest(manifest Manifest, functions []Function, wasi bool) error
- type Size
- type Val
- type ValType
- type Wasm
- type WasmData
- type WasmFile
- type WasmUrl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetLogFile ¶
SetLogFile sets the log file and level, this is a global setting
func ValGetF32 ¶ added in v0.2.0
ValGetF32 returns a float32 from an ExtismVal, it accepts a pointer to a C.ExtismVal
func ValGetF64 ¶ added in v0.2.0
ValGetF32 returns a float64 from an ExtismVal, it accepts a pointer to a C.ExtismVal
func ValGetI32 ¶ added in v0.2.0
ValGetI32 returns an int32 from an ExtismVal, it accepts a pointer to a C.ExtismVal
func ValGetI64 ¶ added in v0.2.0
ValGetI64 returns an I64 from an ExtismVal, it accepts a pointer to a C.ExtismVal
func ValGetUInt ¶ added in v0.2.0
ValGetUInt returns a uint from an ExtismVal, it accepts a pointer to a C.ExtismVal
func ValSetF32 ¶ added in v0.2.0
ValSetF32 stores a float32 in an ExtismVal, it accepts a pointer to a C.ExtismVal and the new value
func ValSetF64 ¶ added in v0.2.0
ValSetF64 stores a float64 in an ExtismVal, it accepts a pointer to a C.ExtismVal and the new value
Types ¶
type CancelHandle ¶ added in v0.3.0
type CancelHandle struct {
// contains filtered or unexported fields
}
func (*CancelHandle) Cancel ¶ added in v0.3.0
func (c *CancelHandle) Cancel() bool
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context is used to manage Plugins
func NewContext ¶
func NewContext() Context
NewContext creates a new context, it should be freed using the `Free` method
type CurrentPlugin ¶ added in v0.2.0
type CurrentPlugin struct {
// contains filtered or unexported fields
}
func GetCurrentPlugin ¶ added in v0.2.0
func GetCurrentPlugin(ptr unsafe.Pointer) CurrentPlugin
func (*CurrentPlugin) Alloc ¶ added in v0.2.0
func (p *CurrentPlugin) Alloc(n uint) uint
Alloc a new memory block of the given length, returning its offset
func (*CurrentPlugin) Free ¶ added in v0.2.0
func (p *CurrentPlugin) Free(offs uint)
Free the memory block specified by the given offset
func (*CurrentPlugin) InputBytes ¶ added in v0.3.0
func (p *CurrentPlugin) InputBytes(v unsafe.Pointer) []byte
func (*CurrentPlugin) InputString ¶ added in v0.3.0
func (p *CurrentPlugin) InputString(v unsafe.Pointer) string
func (*CurrentPlugin) Length ¶ added in v0.2.0
func (p *CurrentPlugin) Length(offs uint) uint
Length returns the number of bytes allocated at the specified offset
func (*CurrentPlugin) Memory ¶ added in v0.2.0
func (p *CurrentPlugin) Memory(offs uint) []byte
func (*CurrentPlugin) ReturnBytes ¶ added in v0.3.0
func (p *CurrentPlugin) ReturnBytes(v unsafe.Pointer, b []byte)
func (*CurrentPlugin) ReturnString ¶ added in v0.3.0
func (p *CurrentPlugin) ReturnString(v unsafe.Pointer, s string)
type Function ¶ added in v0.2.0
type Function struct {
// contains filtered or unexported fields
}
Function is used to define host functions
func NewFunction ¶ added in v0.2.0
func NewFunction(name string, inputs []ValType, outputs []ValType, f unsafe.Pointer, userData interface{}) Function
NewFunction creates a new host function with the given name, input/outputs and optional user data, which can be an arbitrary `interface{}`
func (*Function) SetNamespace ¶ added in v0.3.0
func (Function) WithNamespace ¶ added in v0.3.0
type Manifest ¶
type Manifest struct { Wasm []Wasm `json:"wasm"` Memory struct { MaxPages uint32 `json:"max_pages,omitempty"` } `json:"memory,omitempty"` Config map[string]string `json:"config,omitempty"` AllowedHosts []string `json:"allowed_hosts,omitempty"` AllowedPaths map[string]string `json:"allowed_paths,omitempty"` Timeout uint `json:"timeout_ms,omitempty"` }
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin is used to call WASM functions
func NewPluginFromManifest ¶ added in v0.4.0
NewPlugin creates a plugin in its own context from a manifest
func (*Plugin) CancelHandle ¶ added in v0.3.0
func (p *Plugin) CancelHandle() CancelHandle
func (Plugin) FunctionExists ¶
FunctionExists returns true when the named function is present in the plugin
type Size ¶ added in v0.2.0
type Size = C.ExtismSize
type ValType ¶ added in v0.2.0
type ValType = C.ExtismValType