parser

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 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 Context

type Context struct {
	EncodingConfig *params.EncodingConfig
	Node           node.Node
	Database       database.Database
	Logger         logging.Logger
	Modules        []modules.Module
}

Context represents the context that is shared among different workers

func NewContext

func NewContext(
	encodingConfig *params.EncodingConfig, proxy node.Node, db database.Database,
	logger logging.Logger, modules []modules.Module,
) *Context

NewContext builds a new Context instance

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(ctx *Context, queue types.HeightQueue, index int) Worker

NewWorker allows to create a new Worker implementation.

func (Worker) ExportBlock

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

func (w Worker) ExportCommit(commit *tmtypes.Commit, vals *tmctypes.ResultValidators) error

ExportCommit accepts a block commitment and a corresponding set of validators for the commitment and persists them to the database. An error is returned if any write fails or if there is any missing aggregated data.

func (Worker) ExportTxs

func (w Worker) ExportTxs(txs []types.TxResponse) 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(genesisDoc *tmtypes.GenesisDoc) error

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

func (Worker) Process

func (w Worker) Process(height int64) error

Process fetches a block for a given height and associated metadata and export it to a database. It returns an error if any export process fails.

func (Worker) ProcessIfNotExists

func (w Worker) ProcessIfNotExists(height int64) error

ProcessIfNotExists defines the job consumer workflow. It will fetch a block for a given height and associated metadata and export it to a database if it does not exist yet. It returns an error if any export process fails.

func (Worker) ProcessTransactions

func (w Worker) ProcessTransactions(height int64) error

ProcessTransactions fetches transactions for a given height and stores them into the database. It returns an error if the export process fails.

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.

func (Worker) UnmarshalTxs

func (w Worker) UnmarshalTxs(block *tmctypes.ResultBlock) ([]types.TxResponse, error)

UnmarshalTxs process all transactions contained in a block

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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