Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var LoggerFuncs = []funcs{ { "println", []parm{i32, i32}, []parm{}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { message := readStringFromStack(mod, stack[0:]) length := uint32(stack[1]) call := wasm.FromContext(ctx) if call.ReachedLogsMaxByteCount() { return } if length > wasm.MaxLogByteCount { panic(fmt.Errorf("message to log is too big, max size is %s", humanize.IBytes(uint64(length)))) } if tracer.Enabled() { zlog.Debug(message, zap.String("module_name", call.ModuleName), zap.String("log_source", "wasm")) } call.AppendLog(message) }), }, }
View Source
var RustBasedSauce = runtimeSauce{"alloc", "dealloc"}
View Source
var StateFuncs = []funcs{ { "set", []parm{i64, i32, i32, i32, i32}, []parm{}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { ord := stack[0] key := readStringFromStack(mod, stack[1:]) value := readBytesFromStack(mod, stack[3:]) call := wasm.FromContext(ctx) call.DoSet(ord, key, value) }), }, { "set_if_not_exists", []parm{i64, i32, i32, i32, i32}, []parm{}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { ord := stack[0] key := readStringFromStack(mod, stack[1:]) value := readBytesFromStack(mod, stack[3:]) call := wasm.FromContext(ctx) call.DoSetIfNotExists(ord, key, value) }), }, { "append", []parm{i64, i32, i32, i32, i32}, []parm{}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { ord := stack[0] key := readStringFromStack(mod, stack[1:]) value := readBytesFromStack(mod, stack[3:]) call := wasm.FromContext(ctx) call.DoAppend(ord, key, value) }), }, { "delete_prefix", []parm{i64, i32, i32}, []parm{}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { ord := stack[0] prefix := readStringFromStack(mod, stack[1:]) call := wasm.FromContext(ctx) call.DoDeletePrefix(ord, prefix) }), }, { "add_bigint", []parm{i64, i32, i32, i32, i32}, []parm{}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { ord := stack[0] key := readStringFromStack(mod, stack[1:]) value := readStringFromStack(mod, stack[3:]) call := wasm.FromContext(ctx) call.DoAddBigInt(ord, key, value) }), }, { "add_bigdecimal", []parm{i64, i32, i32, i32, i32}, []parm{}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { ord := stack[0] key := readStringFromStack(mod, stack[1:]) value := readStringFromStack(mod, stack[3:]) call := wasm.FromContext(ctx) call.DoAddBigDecimal(ord, key, value) }), }, { "add_int64", []parm{i64, i32, i32, i64}, []parm{}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { ord := stack[0] key := readStringFromStack(mod, stack[1:]) value := int64(stack[3]) call := wasm.FromContext(ctx) call.DoAddInt64(ord, key, value) }), }, { "add_float64", []parm{i64, i32, i32, f64}, []parm{}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { ord := stack[0] key := readStringFromStack(mod, stack[1:]) value := api.DecodeF64(stack[3]) call := wasm.FromContext(ctx) call.DoAddFloat64(ord, key, value) }), }, { "set_min_int64", []parm{i64, i32, i32, i64}, []parm{}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { ord := stack[0] key := readStringFromStack(mod, stack[1:]) value := int64(stack[3]) call := wasm.FromContext(ctx) call.DoSetMinInt64(ord, key, value) }), }, { "set_min_bigint", []parm{i64, i32, i32, i32, i32}, []parm{}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { ord := stack[0] key := readStringFromStack(mod, stack[1:]) value := readStringFromStack(mod, stack[3:]) call := wasm.FromContext(ctx) call.DoSetMinBigInt(ord, key, value) }), }, { "set_min_float64", []parm{i64, i32, i32, f64}, []parm{}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { ord := stack[0] key := readStringFromStack(mod, stack[1:]) value := api.DecodeF64(stack[3]) call := wasm.FromContext(ctx) call.DoSetMinFloat64(ord, key, value) }), }, { "set_min_bigdecimal", []parm{i64, i32, i32, i32, i32}, []parm{}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { ord := stack[0] key := readStringFromStack(mod, stack[1:]) value := readStringFromStack(mod, stack[3:]) call := wasm.FromContext(ctx) call.DoSetMinBigDecimal(ord, key, value) }), }, { "set_max_int64", []parm{i64, i32, i32, i64}, []parm{}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { ord := stack[0] key := readStringFromStack(mod, stack[1:]) value := int64(stack[3]) call := wasm.FromContext(ctx) call.DoSetMaxInt64(ord, key, value) }), }, { "set_max_bigint", []parm{i64, i32, i32, i32, i32}, []parm{}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { ord := stack[0] key := readStringFromStack(mod, stack[1:]) value := readStringFromStack(mod, stack[3:]) call := wasm.FromContext(ctx) call.DoSetMaxBigInt(ord, key, value) }), }, { "set_max_float64", []parm{i64, i32, i32, f64}, []parm{}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { ord := stack[0] key := readStringFromStack(mod, stack[1:]) value := api.DecodeF64(stack[3]) call := wasm.FromContext(ctx) call.DoSetMaxFloat64(ord, key, value) }), }, { "set_max_bigdecimal", []parm{i64, i32, i32, i32, i32}, []parm{}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { ord := stack[0] key := readStringFromStack(mod, stack[1:]) value := readStringFromStack(mod, stack[3:]) call := wasm.FromContext(ctx) call.DoSetMaxBigDecimal(ord, key, value) }), }, { "get_at", []parm{i32, i64, i32, i32, i32}, []parm{i32}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { storeIndex := uint32(stack[0]) ord := stack[1] key := readStringFromStack(mod, stack[2:]) outputPtr := uint32(stack[4]) call := wasm.FromContext(ctx) inst := instanceFromContext(ctx) value, found := call.DoGetAt(int(storeIndex), ord, key) setStackAndOutput(ctx, stack, call, found, inst, outputPtr, value) }), }, { "has_at", []parm{i32, i64, i32, i32}, []parm{i32}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { storeIndex := uint32(stack[0]) ord := stack[1] key := readStringFromStack(mod, stack[2:]) call := wasm.FromContext(ctx) found := call.DoHasAt(int(storeIndex), ord, key) setStack0Bool(stack, found) }), }, { "get_first", []parm{i32, i32, i32, i32}, []parm{i32}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { storeIndex := uint32(stack[0]) key := readStringFromStack(mod, stack[1:]) outputPtr := uint32(stack[3]) call := wasm.FromContext(ctx) inst := instanceFromContext(ctx) value, found := call.DoGetFirst(int(storeIndex), key) setStackAndOutput(ctx, stack, call, found, inst, outputPtr, value) }), }, { "has_first", []parm{i32, i32, i32}, []parm{i32}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { storeIndex := uint32(stack[0]) key := readStringFromStack(mod, stack[1:]) call := wasm.FromContext(ctx) found := call.DoHasFirst(int(storeIndex), key) setStack0Bool(stack, found) }), }, { "get_last", []parm{i32, i32, i32, i32}, []parm{i32}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { storeIndex := uint32(stack[0]) key := readStringFromStack(mod, stack[1:]) outputPtr := uint32(stack[3]) call := wasm.FromContext(ctx) inst := instanceFromContext(ctx) value, found := call.DoGetLast(int(storeIndex), key) setStackAndOutput(ctx, stack, call, found, inst, outputPtr, value) }), }, { "has_last", []parm{i32, i32, i32}, []parm{i32}, api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { storeIndex := uint32(stack[0]) key := readStringFromStack(mod, stack[1:]) call := wasm.FromContext(ctx) found := call.DoHasLast(int(storeIndex), key) setStack0Bool(stack, found) }), }, }
View Source
var TinyGoSauce = runtimeSauce{"malloc", "free"}
Functions ¶
func AddHostFunctions ¶ added in v1.6.0
Types ¶
type Instance ¶ added in v1.6.0
func NewInstance ¶ added in v1.6.0
type Module ¶
A Module represents a wazero.Runtime that clears and is destroyed upon completion of a request. It has the pre-compiled `env` host module, as well as pre-compiled WASM code provided by the user
func (*Module) ExecuteNewCall ¶
Click to show internal directories.
Click to hide internal directories.