tracker

package
v0.31.14 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consensus

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

Consensus is the DPS consensus follower, which uses a local protocol state database to retrieve consensus-dependent data, while falling back on an record holder to complement the rest of the data. It provides a callback for the unstaked consensus follower on the Flow network that allows it to update the cached data each time a block is finalized. Consensus implements the `Chain` interface needed by the DPS indexer.

func NewConsensus

func NewConsensus(log zerolog.Logger, db *badger.DB, hold RecordHolder) (*Consensus, error)

NewConsensus returns a new instance of the DPS consensus follower, reading from the provided protocol state database and the provided block record holder.

func (*Consensus) Collections

func (c *Consensus) Collections(height uint64) ([]*flow.LightCollection, error)

Collections returns the light collections for the finalized block at the given height.

func (*Consensus) Commit

func (c *Consensus) Commit(height uint64) (flow.StateCommitment, error)

Commit returns the state commitment for the given height, if available.

func (*Consensus) Events

func (c *Consensus) Events(height uint64) ([]flow.Event, error)

Events returns the transaction events for the finalized block at the given height.

func (*Consensus) Guarantees

func (c *Consensus) Guarantees(height uint64) ([]*flow.CollectionGuarantee, error)

Guarantees returns the collection guarantees for the given height, if available.

func (*Consensus) Header

func (c *Consensus) Header(height uint64) (*flow.Header, error)

Header returns the header for the given height, if available. Once a header has been successfully retrieved, all block payload data at a height lower than the returned payload are purged from the cache.

func (*Consensus) OnBlockFinalized

func (c *Consensus) OnBlockFinalized(block *model.Block)

OnBlockFinalized is a callback that notifies the consensus tracker of a new finalized block.

func (*Consensus) Results

func (c *Consensus) Results(height uint64) ([]*flow.TransactionResult, error)

Results returns the transaction results for the finalized block at the given height.

func (*Consensus) Root

func (c *Consensus) Root() (uint64, error)

Root returns the root height from the underlying protocol state.

func (*Consensus) Seals

func (c *Consensus) Seals(height uint64) ([]*flow.Seal, error)

Seals returns the block seals for the given height, if available.

func (*Consensus) Transactions

func (c *Consensus) Transactions(height uint64) ([]*flow.TransactionBody, error)

Transactions returns the transaction bodies for the finalized block at the given height.

type Execution

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

Execution is the DPS execution follower, which keeps track of updates to the execution state. It retrieves block records (block data updates) from a streamer and extracts the trie updates for consumers. It also makes the rest of the block record data available for external consumers by block ID.

func NewExecution

func NewExecution(log zerolog.Logger, db *badger.DB, stream RecordStreamer) (*Execution, error)

NewExecution creates a new DPS execution follower, relying on the provided stream of block records (block data updates).

func (*Execution) AllUpdates added in v0.31.4

func (e *Execution) AllUpdates() ([]*ledger.TrieUpdate, error)

AllUpdates provides all trie updates in the execution record of the next block in the queue

func (*Execution) Record

func (e *Execution) Record(blockID flow.Identifier) (*uploader.BlockData, error)

Record returns the block record for the given block ID, if it is available. Once a block record is returned, all block records at a height lower than the height of the returned record are purged from the cache.

type RecordHolder

type RecordHolder interface {
	Record(blockID flow.Identifier) (*uploader.BlockData, error)
}

RecordHolder represents something that can be used to request block data for a specific block identifier.

type RecordStreamer

type RecordStreamer interface {
	Next() (*uploader.BlockData, error)
}

RecordStreamer represents something that can stream block data.

Jump to

Keyboard shortcuts

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