observer

package
v0.0.0-...-cbb836e Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Observer

type Observer struct {
	DB     *gorm.DB
	Config *util.ObserverConfig
	Client *client.GreenfieldClient
}

func NewObserver

func NewObserver(db *gorm.DB, cfg *util.ObserverConfig, client *client.GreenfieldClient) *Observer

NewObserver returns the observer instance

func (*Observer) Alert

func (ob *Observer) Alert()

Alert sends alerts to tg group if there is no new block fetched in a specific time

func (*Observer) DeleteBlockAndEvents

func (ob *Observer) DeleteBlockAndEvents(height int64) error

DeleteBlockAndEvents deletes the block and txs of the given height

func (*Observer) Fetch

func (ob *Observer) Fetch(startHeight int64)

Fetch starts the main routine for fetching blocks of BSC

func (*Observer) GetCurrentBlockLog

func (ob *Observer) GetCurrentBlockLog() (*model.BlockLog, error)

GetCurrentBlockLog returns the highest block log

func (*Observer) ProcessConfirmedEvent

func (ob *Observer) ProcessConfirmedEvent()

func (*Observer) PruneBlocks

func (ob *Observer) PruneBlocks()

PruneBlocks prunes the outdated blocks

func (*Observer) SaveBlockAndEvents

func (ob *Observer) SaveBlockAndEvents(blockLog *model.BlockLog, packages []interface{}) error

SaveBlockAndEvents saves block and packages to database

func (*Observer) Start

func (ob *Observer) Start()

Start starts the routines of observer

func (*Observer) UpdateConfirmedNum

func (ob *Observer) UpdateConfirmedNum(height int64) error

UpdateConfirmedNum updates confirmation number of events

Jump to

Keyboard shortcuts

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