Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HostCallHandler ¶
type HostCallHandler func(ctx context.Context, binding, namespace, operation string, payload []byte) ([]byte, error)
HostCallHandler is a function to invoke to handle when a guest is performing a host call.
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
Instance is a single instantiation of a module with its own memory.
func (*Instance) Close ¶
func (i *Instance) Close()
Close closes the single instance. This should be called before calling `Close` on the Module itself.
func (*Instance) Invoke ¶
Invoke calls `operation` with `payload` on the module and returns a byte slice payload.
func (*Instance) MemorySize ¶
MemorySize returns the memory length of the underlying instance.
type Logger ¶
type Logger func(msg string)
Logger is the function to call from consoleLog inside a waPC module.
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module represents a compile waPC module.
func New ¶
func New(code []byte, hostCallHandler HostCallHandler) (*Module, error)
New compiles a `Module` from `code`.
func (*Module) Close ¶
func (m *Module) Close()
Close closes the module. This should be called after calling `Close` on any instances that were created.
func (*Module) Instantiate ¶
Instantiate creates a single instance of the module with its own memory.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool is a wrapper around a ringbuffer of WASM modules
func NewPool ¶
NewPool takes in compiled WASM module and a size and returns a pool containing `size` instances of that module.
func (*Pool) Close ¶
func (p *Pool) Close()
Close closes down all the instances contained by the pool.