dispatch

package
v1.9.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: Apache-2.0, MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor interface {
	// Exports has a list of method available on the actor.
	Exports() []interface{}
	// Code returns the code ID for this actor.
	Code() cid.Cid

	// State returns a new State object for this actor. This can be used to
	// decode the actor's state.
	State() cbor.Er
}

Actor is the interface all actors have to implement.

type ActorInfo

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

ActorInfo vm contract actor

type ActorPredicate

type ActorPredicate func(vmr.Runtime, cid.Cid) error

An ActorPredicate returns an error if the given actor is not valid for the given runtime environment (e.g., chain height, version, etc.).

func ActorsVersionPredicate

func ActorsVersionPredicate(ver actorstypes.Version) ActorPredicate

ActorsVersionPredicate get actor predicate base on actor version and network version

type CodeLoader

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

CodeLoader allows you to load an actor's code based on its id an epoch.

func (CodeLoader) GetActorImpl

func (cl CodeLoader) GetActorImpl(code cid.Cid, rt vmr.Runtime) (Dispatcher, *ExcuteError)

GetActorImpl returns executable code for an actor by code cid at a specific network version

func (CodeLoader) GetUnsafeActorImpl

func (cl CodeLoader) GetUnsafeActorImpl(code cid.Cid) (Dispatcher, error)

GetActorImpl returns executable code for an actor by code cid at a specific protocol version

func (CodeLoader) GetVMActor added in v1.7.0

func (cl CodeLoader) GetVMActor(code cid.Cid) (builtin.RegistryEntry, error)

type CodeLoaderBuilder

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

CodeLoaderBuilder helps you build a CodeLoader.

func NewBuilder

func NewBuilder() *CodeLoaderBuilder

NewBuilder creates a builder to generate a builtin.Actor data structure

func (*CodeLoaderBuilder) Add

Add lets you add an actor dispatch table for a given version.

func (*CodeLoaderBuilder) AddMany

Add lets you add an actor dispatch table for a given version.

func (*CodeLoaderBuilder) Build

func (b *CodeLoaderBuilder) Build() CodeLoader

Build builds the code loader.

type Dispatcher

type Dispatcher interface {
	// Dispatch will call the given method on the actor and pass the arguments.
	//
	// - The `ctx` argument will be coerced to the type the method expects in its first argument.
	// - If arg1 is `[]byte`, it will attempt to decode the value based on second argument in the target method.
	Dispatch(method abi.MethodNum, nvk network.Version, ctx interface{}, arg1 interface{}) ([]byte, *ExcuteError)
	// Signature is a helper function that returns the signature for a given method.
	//
	// Note: This is intended to be used by tests and tools.
	Signature(method abi.MethodNum) (MethodSignature, *ExcuteError)
}

Dispatcher allows for dynamic method dispatching on an actor.

type ExcuteError

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

ExcuteError error in vm excute

func NewExcuteError

func NewExcuteError(code exitcode.ExitCode, msg string, args ...interface{}) *ExcuteError

func (*ExcuteError) Error

func (err *ExcuteError) Error() string

func (*ExcuteError) ExitCode

func (err *ExcuteError) ExitCode() exitcode.ExitCode

type MethodSignature

type MethodSignature interface {
	// ArgNil returns a nil interface for the typed argument expected by the actor method.
	ArgNil() reflect.Value
	// ArgInterface returns the typed argument expected by the actor method.
	ArgInterface(argBytes []byte) (interface{}, error)
}

MethodSignature wraps a specific method and allows you to encode/decodes input/output bytes into concrete types.

type SimpleParams

type SimpleParams struct {
	Name string
}

func (*SimpleParams) MarshalCBOR

func (t *SimpleParams) MarshalCBOR(w io.Writer) error

func (*SimpleParams) UnmarshalCBOR

func (t *SimpleParams) UnmarshalCBOR(r io.Reader) (err error)

Jump to

Keyboard shortcuts

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