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 ActorPredicate ¶
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 specactors.Version) ActorPredicate
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 protocol 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
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 ¶
func (b *CodeLoaderBuilder) Add(predict ActorPredicate, actor Actor) *CodeLoaderBuilder
Add lets you add an actor dispatch table for a given version.
func (*CodeLoaderBuilder) AddMany ¶
func (b *CodeLoaderBuilder) AddMany(predict ActorPredicate, actors ...runtime.VMActor) *CodeLoaderBuilder
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
}
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) error