computation

package
v0.28.12 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: AGPL-3.0 Imports: 27 Imported by: 3 modules, 6 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultScriptLogThreshold       = 1 * time.Second
	DefaultScriptExecutionTimeLimit = 10 * time.Second

	MaxScriptErrorMessageSize = 1000 // 1000 chars

	ReusableCadenceRuntimePoolSize = 1000
)

Variables

This section is empty.

Functions

func GetUploaderEnabled added in v0.28.0

func GetUploaderEnabled() bool

func SetUploaderEnabled added in v0.25.0

func SetUploaderEnabled(enabled bool)

Types

type ComputationConfig added in v0.28.0

type ComputationConfig struct {
	CadenceTracing           bool
	ExtensiveTracing         bool
	ProgramsCacheSize        uint
	ScriptLogThreshold       time.Duration
	ScriptExecutionTimeLimit time.Duration

	// When NewCustomVirtualMachine is nil, the manager will create a standard
	// fvm virtual machine via fvm.NewVirtualMachine.  Otherwise, the manager
	// will create a virtual machine using this function.
	//
	// Note that this is primarily used for testing.
	NewCustomVirtualMachine func() computer.VirtualMachine
}

type ComputationManager

type ComputationManager interface {
	ExecuteScript(context.Context, []byte, [][]byte, *flow.Header, state.View) ([]byte, error)
	ComputeBlock(
		ctx context.Context,
		block *entity.ExecutableBlock,
		view state.View,
	) (*execution.ComputationResult, error)
	GetAccount(addr flow.Address, header *flow.Header, view state.View) (*flow.Account, error)
}

type Manager

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

Manager manages computation and execution

func New

func New(
	logger zerolog.Logger,
	metrics module.ExecutionMetrics,
	tracer module.Tracer,
	me module.Local,
	protoState protocol.State,
	vmCtx fvm.Context,
	committer computer.ViewCommitter,
	uploaders []uploader.Uploader,
	executionDataProvider *provider.Provider,
	params ComputationConfig,
) (*Manager, error)

func (*Manager) ComputeBlock

func (e *Manager) ComputeBlock(
	ctx context.Context,
	block *entity.ExecutableBlock,
	view state.View,
) (*execution.ComputationResult, error)

func (*Manager) ExecuteScript

func (e *Manager) ExecuteScript(
	ctx context.Context,
	code []byte,
	arguments [][]byte,
	blockHeader *flow.Header,
	view state.View,
) ([]byte, error)

func (*Manager) GetAccount

func (e *Manager) GetAccount(address flow.Address, blockHeader *flow.Header, view state.View) (*flow.Account, error)

func (*Manager) VM added in v0.28.0

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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