processors

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: Apache-2.0, BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBuiltinProcessorType

func GetBuiltinProcessorType(programHash hashing.HashValue) (string, bool)

GetBuiltinProcessorType locates hardcoded processor: core contract or example

func NewProcessorFromBinary

func NewProcessorFromBinary(vmtype string, binaryCode []byte) (coretypes.Processor, error)

NewProcessorFromBinary creates an instance of the processor by its VM type and the binary code

func RegisterVMType

func RegisterVMType(vmtype string, constructor VMConstructor) error

RegisterVMType registers new VM type by providing a constructor function to construct an instance of the processor. The constructor is a closure which also may encompass configuration params for the VM The function is normally called from the init code

Types

type ProcessorCache

type ProcessorCache struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

ProcessorCache is an object maintained by each chain

func MustNew

func MustNew() *ProcessorCache

func (*ProcessorCache) ExistsProcessor

func (cps *ProcessorCache) ExistsProcessor(h hashing.HashValue) bool

func (*ProcessorCache) GetOrCreateProcessor

func (cps *ProcessorCache) GetOrCreateProcessor(rec *root.ContractRecord, getBinary func(hashing.HashValue) (string, []byte, error)) (coretypes.Processor, error)

func (*ProcessorCache) GetOrCreateProcessorByProgramHash

func (cps *ProcessorCache) GetOrCreateProcessorByProgramHash(progHash hashing.HashValue, getBinary func(hashing.HashValue) (string, []byte, error)) (coretypes.Processor, error)

func (*ProcessorCache) NewProcessor

func (cps *ProcessorCache) NewProcessor(programHash hashing.HashValue, programCode []byte, vmtype string) error

NewProcessor deploys new processor in the cache

func (*ProcessorCache) RemoveProcessor

func (cps *ProcessorCache) RemoveProcessor(h hashing.HashValue)

RemoveProcessor deletes processor from cache

type VMConstructor

type VMConstructor func(binaryCode []byte) (coretypes.Processor, error)

Jump to

Keyboard shortcuts

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