blocksyncer

package
v0.1.1-dev-2 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewIndexer

func NewIndexer(codec codec.Codec, proxy node.Node, db database.Database, modules []modules.Module) parser.Indexer

Types

type BlockSyncer

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

BlockSyncer synchronizes storage,payment,permission data to db by handling related events

func NewBlockSyncerService

func NewBlockSyncerService(cfg *tomlconfig.TomlConfig) (*BlockSyncer, error)

NewBlockSyncerService create a BlockSyncer service to index block events data to db

func (*BlockSyncer) Name

func (s *BlockSyncer) Name() string

Name describes the name of BlockSyncer service

func (*BlockSyncer) Start

func (s *BlockSyncer) Start(ctx context.Context) error

Start running BlockSyncer service

func (*BlockSyncer) Stop

func (s *BlockSyncer) Stop(ctx context.Context) error

Stop running BlockSyncer service

type Config

type Config struct {
	Modules        []string
	Dsn            string
	RecreateTables bool
}

type Impl

type Impl struct {
	Modules []modules.Module

	Node node.Node
	DB   database.Database
	// contains filtered or unexported fields
}

func (*Impl) ExportAccounts

func (i *Impl) ExportAccounts(block *coretypes.ResultBlock, txs []*types.Tx) error

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

func (*Impl) ExportBlock

func (i *Impl) ExportBlock(block *coretypes.ResultBlock, events *coretypes.ResultBlockResults, txs []*types.Tx, vals *coretypes.ResultValidators) error

ExportBlock accepts a finalized block and persists then inside the database. An error is returned if write fails.

func (*Impl) ExportCommit

func (i *Impl) ExportCommit(block *coretypes.ResultBlock, vals *coretypes.ResultValidators) error

ExportCommit accepts ResultValidators and persists validator commit signatures inside the database. An error is returned if write fails.

func (*Impl) ExportEpoch

func (i *Impl) ExportEpoch(block *coretypes.ResultBlock) error

ExportEpoch accept a block result data and persist basic info into db to record current sync progress

func (*Impl) ExportEvents

func (i *Impl) ExportEvents(ctx context.Context, block *coretypes.ResultBlock, events *coretypes.ResultBlockResults) error

ExportEvents accepts a slice of transactions and get events in order to save in database.

func (*Impl) ExportTxs

func (i *Impl) ExportTxs(block *coretypes.ResultBlock, txs []*types.Tx) error

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

func (*Impl) ExportValidators

func (i *Impl) ExportValidators(block *coretypes.ResultBlock, vals *coretypes.ResultValidators) error

ExportValidators accepts ResultValidators and persists validators inside the database. An error is returned if write fails.

func (*Impl) HandleBlock

func (i *Impl) HandleBlock(block *coretypes.ResultBlock, events *coretypes.ResultBlockResults, txs []*types.Tx, vals *coretypes.ResultValidators)

HandleBlock accepts block and calls the block handlers.

func (*Impl) HandleEvent

func (i *Impl) HandleEvent(ctx context.Context, block *coretypes.ResultBlock, txHash common.Hash, event sdk.Event)

HandleEvent accepts the transaction and handles events contained inside the transaction.

func (*Impl) HandleGenesis

func (i *Impl) HandleGenesis(genesisDoc *tmtypes.GenesisDoc, appState map[string]json.RawMessage) error

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

func (*Impl) HandleMessage

func (i *Impl) HandleMessage(index int, msg sdk.Msg, tx *types.Tx)

HandleMessage accepts the transaction and handles messages contained inside the transaction.

func (*Impl) HandleTx

func (i *Impl) HandleTx(tx *types.Tx)

HandleTx accepts the transaction and calls the tx handlers.

func (*Impl) Process

func (i *Impl) Process(height uint64) 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 (*Impl) Processed

func (i *Impl) Processed(ctx context.Context, height uint64) (bool, error)

Processed tells whether the current Indexer has already processed the given height of Block An error is returned if the operation fails.

Jump to

Keyboard shortcuts

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