tracker

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize

func Initialize(dir string, db *badger.DB) error

Initialize will initialize the Flow protocol state in the given database. The code is inspired by the related unexported code in the Flow Go code base: https://github.com/onflow/flow-go/blob/v0.21.0/cmd/bootstrap/cmd/finalize.go#L452

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(blockID flow.Identifier)

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) 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.

func (*Execution) Update

func (e *Execution) Update() (*ledger.TrieUpdate, error)

Update provides the next trie update from the stream of block records. Trie updates are returned sequentially without regard for the boundary between blocks.

type Payload

type Payload struct {
	Header     *flow.Header
	Guarantees []*flow.CollectionGuarantee
	Seals      []*flow.Seal
}

type RecordHolder

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

type RecordStreamer

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

Jump to

Keyboard shortcuts

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