state

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2020 License: AGPL-3.0 Imports: 12 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommitDelta

func CommitDelta(ledger storage.Ledger, delta delta.Delta, baseState flow.StateCommitment) (flow.StateCommitment, error)

func LedgerGetRegister

func LedgerGetRegister(ledger storage.Ledger, commitment flow.StateCommitment) delta.GetRegisterFunc

Types

type ExecutionState

type ExecutionState interface {
	ReadOnlyExecutionState

	// CommitDelta commits a register delta and returns the new state commitment.
	CommitDelta(context.Context, delta.Delta, flow.StateCommitment) (flow.StateCommitment, error)

	// PersistStateCommitment saves a state commitment by the given block ID.
	PersistStateCommitment(context.Context, flow.Identifier, flow.StateCommitment) error

	// PersistChunkDataPack stores a chunk data pack by chunk ID.
	PersistChunkDataPack(context.Context, *flow.ChunkDataPack) error

	PersistExecutionReceipt(context.Context, *flow.ExecutionReceipt) error

	PersistStateInteractions(context.Context, flow.Identifier, []*delta.Snapshot) error

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

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

func NewExecutionState

func NewExecutionState(
	ls storage.Ledger,
	commits storage.Commits,
	blocks storage.Blocks,
	collections storage.Collections,
	chunkDataPacks storage.ChunkDataPacks,
	results storage.ExecutionResults,
	receipts storage.ExecutionReceipts,
	db *badger.DB,
	tracer module.Tracer,
) ExecutionState

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

type ReadOnlyExecutionState

type ReadOnlyExecutionState interface {
	// NewView creates a new ready-only view at the given state commitment.
	NewView(flow.StateCommitment) *delta.View

	GetRegisters(
		context.Context,
		flow.StateCommitment,
		[]flow.RegisterID,
	) ([]flow.RegisterValue, error)

	GetRegistersWithProofs(
		context.Context,
		flow.StateCommitment,
		[]flow.RegisterID,
	) ([]flow.RegisterValue, []flow.StorageProof, error)

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

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

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

	RetrieveStateDelta(context.Context, flow.Identifier) (*messages.ExecutionStateDelta, error)

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

	GetCollection(identifier flow.Identifier) (*flow.Collection, error)

	DiskSize() (int64, error)
}

ReadOnlyExecutionState allows to read the execution state

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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