execution

package
v0.35.15-crescendo-pre... Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RegisterAtHeight added in v0.32.7

type RegisterAtHeight func(ID flow.RegisterID, height uint64) (flow.RegisterValue, error)

RegisterAtHeight returns register value for provided register ID at the block height. Even if the register wasn't indexed at the provided height, returns the highest height the register was indexed at. If the register with the ID was not indexed at all return nil value and no error. Expected errors: - storage.ErrHeightNotIndexed if the given height was not indexed yet or lower than the first indexed height.

type RegistersAsyncStore added in v0.32.10

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

RegistersAsyncStore wraps an underlying register store so it can be used before the index is initialized.

func NewRegistersAsyncStore added in v0.32.10

func NewRegistersAsyncStore() *RegistersAsyncStore

func (*RegistersAsyncStore) Initialize added in v0.33.9

func (r *RegistersAsyncStore) Initialize(registers storage.RegisterIndex) error

Initialize initializes the underlying storage.RegisterIndex This method can be called at any time after the RegisterStore object is created. and before RegisterValues is called since we can't disambiguate between the underlying store before bootstrapping or just simply being behind sync

func (*RegistersAsyncStore) RegisterValues added in v0.32.10

func (r *RegistersAsyncStore) RegisterValues(ids flow.RegisterIDs, height uint64) ([]flow.RegisterValue, error)

RegisterValues gets the register values from the underlying storage.RegisterIndex Expected errors:

  • indexer.ErrIndexNotInitialized if the store is still bootstrapping
  • storage.ErrHeightNotIndexed if the values at the height is not indexed yet
  • storage.ErrNotFound if the register does not exist at the height

type ScriptExecutor added in v0.32.2

type ScriptExecutor interface {
	// ExecuteAtBlockHeight executes provided script against the block height.
	// A result value is returned encoded as byte array. An error will be returned if script
	// doesn't successfully execute.
	// Expected errors:
	// - storage.ErrNotFound if block or register value at height was not found.
	// - storage.ErrHeightNotIndexed if the data for the block height is not available
	ExecuteAtBlockHeight(
		ctx context.Context,
		script []byte,
		arguments [][]byte,
		height uint64,
	) ([]byte, error)

	// GetAccountAtBlockHeight returns a Flow account by the provided address and block height.
	// Expected errors:
	// - storage.ErrHeightNotIndexed if the data for the block height is not available
	GetAccountAtBlockHeight(ctx context.Context, address flow.Address, height uint64) (*flow.Account, error)

	// GetAccountBalance returns
	// Expected errors:
	// - storage.ErrHeightNotIndexed if the data for the block height is not available
	GetAccountBalance(ctx context.Context, address flow.Address, height uint64) (uint64, error)

	// GetAccountKeys returns
	// Expected errors:
	// - storage.ErrHeightNotIndexed if the data for the block height is not available
	GetAccountKeys(ctx context.Context, address flow.Address, height uint64) ([]flow.AccountPublicKey, error)
}

type Scripts

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

func NewScripts

func NewScripts(
	log zerolog.Logger,
	metrics module.ExecutionMetrics,
	chainID flow.ChainID,
	entropy query.EntropyProviderPerBlock,
	header storage.Headers,
	registerAtHeight RegisterAtHeight,
	queryConf query.QueryConfig,
	derivedChainData *derived.DerivedChainData,
	enableProgramCacheWrites bool,
) *Scripts

func (*Scripts) ExecuteAtBlockHeight

func (s *Scripts) ExecuteAtBlockHeight(
	ctx context.Context,
	script []byte,
	arguments [][]byte,
	height uint64,
) ([]byte, error)

ExecuteAtBlockHeight executes provided script against the block height. A result value is returned encoded as byte array. An error will be returned if script doesn't successfully execute. Expected errors: - Script execution related errors - storage.ErrHeightNotIndexed if the data for the block height is not available

func (*Scripts) GetAccountAtBlockHeight

func (s *Scripts) GetAccountAtBlockHeight(ctx context.Context, address flow.Address, height uint64) (*flow.Account, error)

GetAccountAtBlockHeight returns a Flow account by the provided address and block height. Expected errors: - Script execution related errors - storage.ErrHeightNotIndexed if the data for the block height is not available

func (*Scripts) GetAccountBalance added in v0.35.17

func (s *Scripts) GetAccountBalance(ctx context.Context, address flow.Address, height uint64) (uint64, error)

GetAccountBalance returns a balance of Flow account by the provided address and block height. Expected errors: - Script execution related errors - storage.ErrHeightNotIndexed if the data for the block height is not available

func (*Scripts) GetAccountKeys added in v0.35.17

func (s *Scripts) GetAccountKeys(ctx context.Context, address flow.Address, height uint64) ([]flow.AccountPublicKey, error)

GetAccountKeys returns a public keys of Flow account by the provided address and block height. Expected errors: - Script execution related errors - storage.ErrHeightNotIndexed if the data for the block height is not available

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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