wasm

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Index

Constants

View Source
const ClockType = "sf.substreams.v1.Clock"

Variables

This section is empty.

Functions

This section is empty.

Types

type Argument added in v0.0.21

type Argument interface {
	Name() string
}

type BaseArgument added in v0.0.21

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

func (*BaseArgument) Name added in v0.0.21

func (b *BaseArgument) Name() string

type BaseValueArgument added in v0.0.21

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

func (*BaseValueArgument) SetValue added in v0.0.21

func (b *BaseValueArgument) SetValue(data []byte)

func (*BaseValueArgument) Value added in v0.0.21

func (b *BaseValueArgument) Value() []byte

type Call added in v1.1.1

type Call struct {
	Logs           []string
	LogsByteCount  uint64
	ExecutionStack []string
	// contains filtered or unexported fields
}

func (*Call) Cleanup added in v1.1.1

func (c *Call) Cleanup() error

func (*Call) Err added in v1.1.1

func (c *Call) Err() error

func (*Call) Execute added in v1.1.1

func (c *Call) Execute() (err error)

func (*Call) ExecuteWithArgs added in v1.1.1

func (c *Call) ExecuteWithArgs(args ...interface{}) (err error)

func (*Call) IsValidAddBigDecimalStore added in v1.1.1

func (c *Call) IsValidAddBigDecimalStore() bool

func (*Call) IsValidAddBigIntStore added in v1.1.1

func (c *Call) IsValidAddBigIntStore() bool

func (*Call) IsValidAddFloat64Store added in v1.1.1

func (c *Call) IsValidAddFloat64Store() bool

func (*Call) IsValidAddInt64Store added in v1.1.1

func (c *Call) IsValidAddInt64Store() bool

func (*Call) IsValidAppendStore added in v1.1.1

func (c *Call) IsValidAppendStore() bool

func (*Call) IsValidSetIfNotExists added in v1.1.1

func (c *Call) IsValidSetIfNotExists() bool

func (*Call) IsValidSetMaxBigDecimalStore added in v1.1.1

func (c *Call) IsValidSetMaxBigDecimalStore() bool

func (*Call) IsValidSetMaxBigIntStore added in v1.1.1

func (c *Call) IsValidSetMaxBigIntStore() bool

func (*Call) IsValidSetMaxFloat64Store added in v1.1.1

func (c *Call) IsValidSetMaxFloat64Store() bool

func (*Call) IsValidSetMaxInt64Store added in v1.1.1

func (c *Call) IsValidSetMaxInt64Store() bool

func (*Call) IsValidSetMinBigDecimalStore added in v1.1.1

func (c *Call) IsValidSetMinBigDecimalStore() bool

func (*Call) IsValidSetMinBigIntStore added in v1.1.1

func (c *Call) IsValidSetMinBigIntStore() bool

func (*Call) IsValidSetMinFloat64Store added in v1.1.1

func (c *Call) IsValidSetMinFloat64Store() bool

func (*Call) IsValidSetMinInt64Store added in v1.1.1

func (c *Call) IsValidSetMinInt64Store() bool

func (*Call) IsValidSetStore added in v1.1.1

func (c *Call) IsValidSetStore() bool

func (*Call) Output added in v1.1.1

func (c *Call) Output() []byte

func (*Call) PushExecutionStack added in v1.1.1

func (c *Call) PushExecutionStack(event string)

func (*Call) ReachedLogsMaxByteCount added in v1.1.1

func (c *Call) ReachedLogsMaxByteCount() bool

func (*Call) SetOutputStore added in v1.1.1

func (c *Call) SetOutputStore(store store.Store)

func (*Call) WriteOutputToHeap added in v1.1.1

func (c *Call) WriteOutputToHeap(outputPtr int32, value []byte, from string) error

type Heap

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

func NewHeap

func NewHeap(memory *wasmtime.Memory, allocator, dealloc *wasmtime.Func, store *wasmtime.Store) *Heap

func (*Heap) Clear added in v0.0.19

func (h *Heap) Clear() error

func (*Heap) ReadBytes

func (h *Heap) ReadBytes(ptr int32, length int32) []byte

func (*Heap) ReadString

func (h *Heap) ReadString(ptr int32, length int32) string

func (*Heap) Write

func (h *Heap) Write(bytes []byte, from string) (int32, error)

func (*Heap) WriteAndTrack added in v0.0.19

func (h *Heap) WriteAndTrack(bytes []byte, track bool, from string) (int32, error)

func (*Heap) WriteAtPtr

func (h *Heap) WriteAtPtr(bytes []byte, ptr int32, from string) (int32, error)

type InputType

type InputType int

type Instance

type Instance struct {
	CurrentCall *Call

	Heap *Heap
	// contains filtered or unexported fields
}

func (*Instance) FreeMem added in v1.1.1

func (i *Instance) FreeMem()

func (*Instance) NewCall added in v1.1.1

func (i *Instance) NewCall(clock *pbsubstreams.Clock, arguments []Argument) (*Call, error)

type MapInput added in v0.0.21

type MapInput struct {
	BaseArgument
	BaseValueArgument
}

func NewMapInput added in v0.0.21

func NewMapInput(name string) *MapInput

type Module

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

type PanicError

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

func (*PanicError) Error

func (e *PanicError) Error() string

type ParamsInput added in v1.0.0

type ParamsInput struct {
	BaseArgument
	BaseValueArgument
}

func NewParamsInput added in v1.0.0

func NewParamsInput(value string) *ParamsInput

type Runtime

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

func NewRuntime

func NewRuntime(extensions []WASMExtensioner, maxFuel uint64) *Runtime

func (*Runtime) NewInstance added in v1.1.1

func (r *Runtime) NewInstance(ctx context.Context, module *Module, name, entrypoint string) (*Instance, error)

func (*Runtime) NewModule

func (r *Runtime) NewModule(wasmCode []byte) (*Module, error)

type SourceInput added in v0.0.21

type SourceInput struct {
	BaseArgument
	BaseValueArgument
}

func NewSourceInput added in v0.0.21

func NewSourceInput(name string) *SourceInput

type StoreDeltaInput added in v0.0.21

type StoreDeltaInput struct {
	BaseArgument
	BaseValueArgument
}

func NewStoreDeltaInput added in v0.0.21

func NewStoreDeltaInput(name string) *StoreDeltaInput

type StoreReaderInput added in v0.0.21

type StoreReaderInput struct {
	BaseArgument
	Store store.Store
}

func NewStoreReaderInput added in v0.0.21

func NewStoreReaderInput(name string, store store.Store) *StoreReaderInput

type StoreWriterOutput added in v0.0.21

type StoreWriterOutput struct {
	BaseArgument
	Store        store.Store
	UpdatePolicy pbsubstreams.Module_KindStore_UpdatePolicy
	ValueType    string
}

func NewStoreWriterOutput added in v0.0.21

func NewStoreWriterOutput(name string, store store.Store, updatePolicy pbsubstreams.Module_KindStore_UpdatePolicy, valueType string) *StoreWriterOutput

type ValueArgument added in v0.0.21

type ValueArgument interface {
	Argument
	Value() []byte
	SetValue([]byte)
}

type WASMExtension

type WASMExtension func(ctx context.Context, traceID string, clock *pbsubstreams.Clock, in []byte) (out []byte, err error)

WASMExtension defines the implementation of a function that will be exposed as wasm imports; therefore, exposed to the host language like Rust.

For example, this can be an RPC call, taking a structured request in `in` and outputting a structured response in `out`, both serialized as protobuf messages.

Such a function needs to be registered through RegisterRuntime.

type WASMExtensioner

type WASMExtensioner interface {
	WASMExtensions() map[string]map[string]WASMExtension
}

Jump to

Keyboard shortcuts

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