entity

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: AGPL-3.0 Imports: 1 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlocksByCollection

type BlocksByCollection struct {
	CollectionID flow.Identifier
	// a reversed map to look up which block contains this collection. key is the collection id
	ExecutableBlocks map[flow.Identifier]*ExecutableBlock
}

BlocksByCollection represents a collection that the execution node. has not received its transactions yet. it also holds references to the blocks that contains this collection and are waiting to be executed.

func (*BlocksByCollection) Checksum

func (b *BlocksByCollection) Checksum() flow.Identifier

func (*BlocksByCollection) ID

type CompleteCollection

type CompleteCollection struct {
	Guarantee    *flow.CollectionGuarantee
	Transactions []*flow.TransactionBody
}

A complete collection contains the guarantee and the transactions. the guarantee is the hash of all the transactions. The execution node receives the guarantee from the block, and queries the transactions by the guarantee from the collection node. when receiving a collection from collection node, the execution node will update the Transactions field of a CompleteCollection and make it complete.

func (CompleteCollection) Collection

func (c CompleteCollection) Collection() flow.Collection

func (CompleteCollection) IsCompleted added in v0.10.0

func (c CompleteCollection) IsCompleted() bool

type ExecutableBlock

type ExecutableBlock struct {
	Block               *flow.Block
	CompleteCollections map[flow.Identifier]*CompleteCollection // key is the collection ID.
	StartState          *flow.StateCommitment
	Executing           bool // flag used to indicate if block is being executed, to avoid re-execution
	// contains filtered or unexported fields
}

ExecutableBlock represents a block that can be executed by the VM

It assumes that the Block attached is immutable, so take care in not modifying or changing the inner *flow.Block, otherwise the struct will be in an inconsistent state. It requires the Block is immutable because the it lazy lodas the Block.ID() into the private id field, on the first call to ExecutableBlock.ID() All future calls to ID will not call Block.ID(), therefore it Block changes, the id will not match the Block.

func (*ExecutableBlock) Checksum

func (b *ExecutableBlock) Checksum() flow.Identifier

func (*ExecutableBlock) CollectionAt added in v0.30.0

func (b *ExecutableBlock) CollectionAt(index int) *flow.Collection

CollectionAt returns a collection at the given index, if index out of range, nil will be returned

func (*ExecutableBlock) Collections

func (b *ExecutableBlock) Collections() []*CompleteCollection

func (*ExecutableBlock) CompleteCollectionAt added in v0.31.0

func (b *ExecutableBlock) CompleteCollectionAt(index int) *CompleteCollection

CompleteCollectionAt returns a complete collection at the given index, if index out of range, nil will be returned

func (*ExecutableBlock) HasAllTransactions

func (b *ExecutableBlock) HasAllTransactions() bool

HasAllTransactions returns whether all the transactions for all collections in the block have been received.

func (*ExecutableBlock) HasStartState added in v0.10.0

func (b *ExecutableBlock) HasStartState() bool

HasStartState returns whether the block has StartState, which indicates whether its parent has been executed.

func (*ExecutableBlock) Height

func (b *ExecutableBlock) Height() uint64

func (*ExecutableBlock) ID

ID lazy loads the Block.ID() into the private id field on the first call, and returns the id field in all future calls

func (*ExecutableBlock) IsComplete

func (b *ExecutableBlock) IsComplete() bool

IsComplete returns whether all the data needed to executed the block are ready.

func (*ExecutableBlock) ParentID

func (b *ExecutableBlock) ParentID() flow.Identifier

Jump to

Keyboard shortcuts

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