computation

package
v0.27.5 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: AGPL-3.0 Imports: 26 Imported by: 5

Documentation

Index

Constants

View Source
const DefaultProgramsCacheSize = 1000
View Source
const MaxScriptErrorMessageSize = 1000 // 1000 chars

Variables

View Source
var DefaultScriptExecutionTimeLimit = 10 * time.Second
View Source
var DefaultScriptLogThreshold = 1 * time.Second

Functions

func SetUploaderEnabled added in v0.25.0

func SetUploaderEnabled(enabled bool)

Types

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,
	vm VirtualMachine,
	vmCtx fvm.Context,
	programsCacheSize uint,
	committer computer.ViewCommitter,
	scriptLogThreshold time.Duration,
	scriptExecutionTimeLimit time.Duration,
	uploaders []uploader.Uploader,
	executionDataProvider *provider.Provider,
) (*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)

type ProgramsCache added in v0.14.6

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

func NewProgramsCache added in v0.14.6

func NewProgramsCache(size uint) (*ProgramsCache, error)

func (*ProgramsCache) Get added in v0.14.6

func (pc *ProgramsCache) Get(blockID flow.Identifier) *programs.Programs

func (*ProgramsCache) Set added in v0.14.6

func (pc *ProgramsCache) Set(blockId flow.Identifier, programs *programs.Programs)

type VirtualMachine

type VirtualMachine interface {
	Run(fvm.Context, fvm.Procedure, state.View, *programs.Programs) error
	GetAccount(fvm.Context, flow.Address, state.View, *programs.Programs) (*flow.Account, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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