Documentation
¶
Index ¶
- type Consensus
- func (c *Consensus) Collections(height uint64) ([]*flow.LightCollection, error)
- func (c *Consensus) Commit(height uint64) (flow.StateCommitment, error)
- func (c *Consensus) Events(height uint64) ([]flow.Event, error)
- func (c *Consensus) Guarantees(height uint64) ([]*flow.CollectionGuarantee, error)
- func (c *Consensus) Header(height uint64) (*flow.Header, error)
- func (c *Consensus) OnBlockFinalized(blockID flow.Identifier)
- func (c *Consensus) Results(height uint64) ([]*flow.TransactionResult, error)
- func (c *Consensus) Root() (uint64, error)
- func (c *Consensus) Seals(height uint64) ([]*flow.Seal, error)
- func (c *Consensus) Transactions(height uint64) ([]*flow.TransactionBody, error)
- type Execution
- type RecordHolder
- type RecordStreamer
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 ¶
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 ¶
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) 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).
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 ¶
RecordStreamer represents something that can stream block data.