Documentation ¶
Index ¶
- Variables
- func CheckProgress()
- func DeepCopyByGob(src, dst interface{}) error
- func NewIndexer(codec codec.Codec, proxy node.Node, db database.Database, ...) parser.Indexer
- func StopMainService() error
- func SwitchMasterDBFlag() error
- type BlockSyncer
- type Config
- type Impl
- func (i *Impl) CreateMasterTable() error
- func (i *Impl) ExportAccounts(block *coretypes.ResultBlock, txs []*types.Tx) error
- func (i *Impl) ExportBlock(block *coretypes.ResultBlock, events *coretypes.ResultBlockResults, ...) error
- func (i *Impl) ExportCommit(block *coretypes.ResultBlock, vals *coretypes.ResultValidators) error
- func (i *Impl) ExportEpoch(block *coretypes.ResultBlock) error
- func (i *Impl) ExportEvents(ctx context.Context, block *coretypes.ResultBlock, ...) error
- func (i *Impl) ExportEventsInTxs(ctx context.Context, block *coretypes.ResultBlock, txs []*types.Tx) error
- func (i *Impl) ExportEventsWithoutTx(ctx context.Context, block *coretypes.ResultBlock, events []abci.Event) error
- func (i *Impl) ExportTxs(block *coretypes.ResultBlock, txs []*types.Tx) error
- func (i *Impl) ExportValidators(block *coretypes.ResultBlock, vals *coretypes.ResultValidators) error
- func (i *Impl) GetBlockRecordNum(_ context.Context) int64
- func (i *Impl) GetCatchUpFlag() *atomic.Value
- func (i *Impl) GetLastBlockRecordHeight(ctx context.Context) (uint64, error)
- func (i *Impl) GetLatestBlockHeight() *atomic.Value
- func (i *Impl) GetServiceName() string
- func (i *Impl) HandleBlock(block *coretypes.ResultBlock, events *coretypes.ResultBlockResults, ...)
- func (i *Impl) HandleEvent(ctx context.Context, block *coretypes.ResultBlock, txHash common.Hash, ...) error
- func (i *Impl) HandleGenesis(genesisDoc *tmtypes.GenesisDoc, appState map[string]json.RawMessage) error
- func (i *Impl) HandleMessage(block *coretypes.ResultBlock, index int, msg sdk.Msg, tx *types.Tx)
- func (i *Impl) HandleTx(tx *types.Tx)
- func (i *Impl) Process(height uint64) error
- func (i *Impl) Processed(ctx context.Context, height uint64) (bool, error)
Constants ¶
This section is empty.
Variables ¶
var ( MainService *BlockSyncer BackupService *BlockSyncer FlagDB database.Database NeedBackup bool CancelMain func() CtxMain context.Context )
Read concurrency required global variables
Functions ¶
func CheckProgress ¶ added in v0.2.0
func CheckProgress()
func DeepCopyByGob ¶ added in v0.2.0
func DeepCopyByGob(src, dst interface{}) error
func NewIndexer ¶
func StopMainService ¶ added in v0.2.0
func StopMainService() error
func SwitchMasterDBFlag ¶ added in v0.2.0
func SwitchMasterDBFlag() error
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
type Impl ¶
type Impl struct { Modules []modules.Module Node node.Node DB database.Database LatestBlockHeight atomic.Value CatchUpFlag atomic.Value ServiceName string // contains filtered or unexported fields }
func (*Impl) CreateMasterTable ¶ added in v0.2.0
func (*Impl) ExportAccounts ¶
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) ExportEventsInTxs ¶ added in v0.1.2
func (i *Impl) ExportEventsInTxs(ctx context.Context, block *coretypes.ResultBlock, txs []*types.Tx) error
ExportEventsInTxs accepts a slice of events in tx in order to save in database.
func (*Impl) ExportEventsWithoutTx ¶ added in v0.1.2
func (i *Impl) ExportEventsWithoutTx(ctx context.Context, block *coretypes.ResultBlock, events []abci.Event) error
ExportEventsWithoutTx accepts a slice of events not in tx in order to save in database. events here don't have txHash
func (*Impl) ExportTxs ¶
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) GetBlockRecordNum ¶ added in v0.1.2
GetBlockRecordNum returns total number of blocks stored in database.
func (*Impl) GetCatchUpFlag ¶ added in v0.2.0
func (*Impl) GetLastBlockRecordHeight ¶ added in v0.1.2
GetLastBlockRecordHeight returns the last block height stored inside the database
func (*Impl) GetLatestBlockHeight ¶ added in v0.2.0
func (*Impl) GetServiceName ¶ added in v0.2.0
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) error
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 ¶
HandleMessage accepts the transaction and handles messages contained inside the transaction.