worker

package
v0.0.0-...-a08de0b Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: CC0-1.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	EncodingConfig *params.EncodingConfig
	Queue          types.HeightQueue
	ClientProxy    *client.Proxy
	Database       db.Database
	Modules        []modules.Module
	Logger         logging.Logger
}

func NewConfig

func NewConfig(
	queue types.HeightQueue,
	encodingConfig *params.EncodingConfig,
	clientProxy *client.Proxy,
	db db.Database,
	modules []modules.Module,
	logger logging.Logger,
) *Config

type Worker

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

Worker defines a job consumer that is responsible for getting and aggregating block and associated data and exporting it to a database.

func NewWorker

func NewWorker(index int, config *Config) Worker

NewWorker allows to create a new Worker implementation.

func (Worker) ExportBlock

func (w Worker) ExportBlock(b *flow.Block) error

ExportBlock accepts a finalized block and a corresponding set of transactions and persists them to the database along with attributable metadata. An error is returned if the write fails.

func (Worker) ExportCollection

func (w Worker) ExportCollection(block *flow.Block) ([]types.Collection, error)

func (Worker) ExportTransactionResult

func (w Worker) ExportTransactionResult(txids []flow.Identifier, height int64) error

func (Worker) ExportTx

func (w Worker) ExportTx(txs *types.Txs) error

ExportTxs accepts a slice of transactions and persists then inside the database. An error is returned if the write fails.

func (Worker) HandleGenesis

func (w Worker) HandleGenesis(block *flow.Block) error

HandleGenesis accepts a GenesisDoc and calls all the registered genesis handlers in the order in which they have been registered.

func (Worker) Start

func (w Worker) Start()

Start starts a worker by listening for new jobs (block heights) from the given worker queue. Any failed job is logged and re-enqueued.

Jump to

Keyboard shortcuts

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