state

package
v0.32.1 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: AGPL-3.0 Imports: 16 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBlockExecuted added in v0.11.0

func IsBlockExecuted(ctx context.Context, state ReadOnlyExecutionState, block flow.Identifier) (bool, error)

IsBlockExecuted returns true if the block is executed, which means registers, events, results, statecommitment etc are all stored. otherwise returns false

func NewLedgerStorageSnapshot added in v0.30.0

func NewLedgerStorageSnapshot(
	ldg ledger.Ledger,
	commitment flow.StateCommitment,
) snapshot.StorageSnapshot

func RegisterEntriesToKeysValues added in v0.30.0

func RegisterEntriesToKeysValues(
	entries flow.RegisterEntries,
) (
	[]ledger.Key,
	[]ledger.Value,
)

Types

type ExecutionState

type ExecutionState interface {
	ReadOnlyExecutionState

	UpdateHighestExecutedBlockIfHigher(context.Context, *flow.Header) error

	SaveExecutionResults(
		ctx context.Context,
		result *execution.ComputationResult,
	) error
}

ExecutionState is an interface used to access and mutate the execution state of the blockchain.

func NewExecutionState

func NewExecutionState(
	ls ledger.Ledger,
	commits storage.Commits,
	blocks storage.Blocks,
	headers storage.Headers,
	collections storage.Collections,
	chunkDataPacks storage.ChunkDataPacks,
	results storage.ExecutionResults,
	myReceipts storage.MyExecutionReceipts,
	events storage.Events,
	serviceEvents storage.ServiceEvents,
	transactionResults storage.TransactionResults,
	db *badger.DB,
	tracer module.Tracer,
) ExecutionState

NewExecutionState returns a new execution state access layer for the given ledger storage.

type LedgerStorageSnapshot added in v0.30.0

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

func (*LedgerStorageSnapshot) Get added in v0.30.0

func (storage *LedgerStorageSnapshot) Get(
	id flow.RegisterID,
) (
	flow.RegisterValue,
	error,
)

type ReadOnlyExecutionState

type ReadOnlyExecutionState interface {
	ScriptExecutionState

	// ChunkDataPackByChunkID retrieve a chunk data pack given the chunk ID.
	ChunkDataPackByChunkID(flow.Identifier) (*flow.ChunkDataPack, error)

	GetExecutionResultID(context.Context, flow.Identifier) (flow.Identifier, error)

	GetHighestExecutedBlockID(context.Context) (uint64, flow.Identifier, error)
}

ReadOnlyExecutionState allows to read the execution state

type RegisterUpdatesHolder added in v0.16.0

type RegisterUpdatesHolder interface {
	UpdatedRegisters() flow.RegisterEntries
}

type ScriptExecutionState added in v0.32.0

type ScriptExecutionState interface {
	// NewStorageSnapshot creates a new ready-only view at the given state commitment.
	NewStorageSnapshot(flow.StateCommitment) snapshot.StorageSnapshot

	// StateCommitmentByBlockID returns the final state commitment for the provided block ID.
	StateCommitmentByBlockID(context.Context, flow.Identifier) (flow.StateCommitment, error)

	// HasState returns true if the state with the given state commitment exists in memory
	HasState(flow.StateCommitment) bool
}

ScriptExecutionState is a subset of the `state.ExecutionState` interface purposed to only access the state used for script execution and not mutate the execution state of the blockchain.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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