Documentation ¶
Index ¶
- Constants
- func NewBlockchainContext(host vmhost.VMHost, blockChainHook vmcommon.BlockchainHook) (*blockchainContext, error)
- func NewDisabledGasTracer() *disabledGasTracer
- func NewEnabledGasTracer() *gasTracer
- func NewInstanceTracker() (*instanceTracker, error)
- func NewManagedTypesContext(host vmhost.VMHost) (*managedTypesContext, error)
- func NewMeteringContext(host vmhost.VMHost, gasMap config.GasScheduleMap, blockGasLimit uint64) (*meteringContext, error)
- func NewOutputContext(host vmhost.VMHost) (*outputContext, error)
- func NewReservedFunctions(scAPINames vmcommon.FunctionNames, ...) *reservedFunctions
- func NewRuntimeContext(host vmhost.VMHost, vmType []byte, ...) (*runtimeContext, error)
- func NewStorageContext(host vmhost.VMHost, blockChainHook vmcommon.BlockchainHook, ...) (*storageContext, error)
- func NewVMOutputAccount(address []byte) *vmcommon.OutputAccount
- type Cacher
- type HashComputer
- type WasmerInstanceBuilder
- func (builder *WasmerInstanceBuilder) NewInstanceFromCompiledCodeWithOptions(compiledCode []byte, options wasmer.CompilationOptions) (wasmer.InstanceHandler, error)
- func (builder *WasmerInstanceBuilder) NewInstanceWithOptions(contractCode []byte, options wasmer.CompilationOptions) (wasmer.InstanceHandler, error)
Constants ¶
const ( // Warm indicates that the instance to track is a warm instance Warm instanceCacheLevel = iota // Precompiled indicates that the instance to track is cold and has been created from precompiled code Precompiled // Bytecode indicates that the instance to track is cold and has been created from raw bytecode Bytecode )
const WarmInstancesEnabled = true
WarmInstancesEnabled controls the usage of warm instances
Variables ¶
This section is empty.
Functions ¶
func NewBlockchainContext ¶
func NewBlockchainContext( host vmhost.VMHost, blockChainHook vmcommon.BlockchainHook, ) (*blockchainContext, error)
NewBlockchainContext creates a new blockchainContext
func NewDisabledGasTracer ¶
func NewDisabledGasTracer() *disabledGasTracer
NewDisabledGasTracer creates a new disabledGasTracer
func NewEnabledGasTracer ¶
func NewEnabledGasTracer() *gasTracer
NewEnabledGasTracer creates a new gasTracer
func NewInstanceTracker ¶
func NewInstanceTracker() (*instanceTracker, error)
NewInstanceTracker creates a new instanceTracker instance
func NewManagedTypesContext ¶
NewManagedTypesContext creates a new managedTypesContext
func NewMeteringContext ¶
func NewMeteringContext( host vmhost.VMHost, gasMap config.GasScheduleMap, blockGasLimit uint64, ) (*meteringContext, error)
NewMeteringContext creates a new meteringContext
func NewOutputContext ¶
NewOutputContext creates a new outputContext
func NewReservedFunctions ¶
func NewReservedFunctions(scAPINames vmcommon.FunctionNames, builtInFuncContainer vmcommon.BuiltInFunctionContainer) *reservedFunctions
NewReservedFunctions creates a new reservedFunctions
func NewRuntimeContext ¶
func NewRuntimeContext( host vmhost.VMHost, vmType []byte, builtInFuncContainer vmcommon.BuiltInFunctionContainer, hasher vmhost.HashComputer, ) (*runtimeContext, error)
NewRuntimeContext creates a new runtimeContext
func NewStorageContext ¶
func NewStorageContext( host vmhost.VMHost, blockChainHook vmcommon.BlockchainHook, protectedKeyPrefix []byte, ) (*storageContext, error)
NewStorageContext creates a new storageContext
func NewVMOutputAccount ¶
func NewVMOutputAccount(address []byte) *vmcommon.OutputAccount
NewVMOutputAccount creates a new output account and sets the given address
Types ¶
type Cacher ¶
type Cacher interface { // Clear is used to completely clear the cache. Clear() // Put adds a value to the cache. Returns true if an eviction occurred. Put(key []byte, value interface{}, sizeInBytes int) (evicted bool) // Get looks up a key's value from the cache. Get(key []byte) (value interface{}, ok bool) // Has checks if a key is in the cache, without updating the // recent-ness or deleting it for being stale. Has(key []byte) bool // Peek returns the key value (or undefined if not found) without updating // the "recently used"-ness of the key. Peek(key []byte) (value interface{}, ok bool) // HasOrAdd checks if a key is in the cache without updating the // recent-ness or deleting it for being stale, and if not adds the value. HasOrAdd(key []byte, value interface{}, sizeInBytes int) (has, added bool) // Remove removes the provided key from the cache. Remove(key []byte) // Keys returns a slice of the keys in the cache, from oldest to newest. Keys() [][]byte // Len returns the number of items in the cache. Len() int // SizeInBytesContained returns the size in bytes of all contained elements SizeInBytesContained() uint64 // MaxSize returns the maximum number of items which can be stored in the cache. MaxSize() int // RegisterHandler registers a new handler to be called when a new data is added RegisterHandler(handler func(key []byte, value interface{}), id string) // UnRegisterHandler deletes the handler from the list UnRegisterHandler(id string) // Close closes the underlying temporary db if the cacher implementation has one, // otherwise it does nothing Close() error // IsInterfaceNil returns true if there is no value under the interface IsInterfaceNil() bool }
Cacher provides caching services
type HashComputer ¶
HashComputer provides hash computation
type WasmerInstanceBuilder ¶
type WasmerInstanceBuilder struct { }
WasmerInstanceBuilder is the default instance builder, which produces real Wasmer instances from WASM bytecode
func (*WasmerInstanceBuilder) NewInstanceFromCompiledCodeWithOptions ¶
func (builder *WasmerInstanceBuilder) NewInstanceFromCompiledCodeWithOptions( compiledCode []byte, options wasmer.CompilationOptions, ) (wasmer.InstanceHandler, error)
NewInstanceFromCompiledCodeWithOptions creates a new Wasmer instance from precompiled machine code, respecting the provided options
func (*WasmerInstanceBuilder) NewInstanceWithOptions ¶
func (builder *WasmerInstanceBuilder) NewInstanceWithOptions( contractCode []byte, options wasmer.CompilationOptions, ) (wasmer.InstanceHandler, error)
NewInstanceWithOptions creates a new Wasmer instance from WASM bytecode, respecting the provided options