Documentation ¶
Index ¶
- type Observer
- func (ob *Observer) Alert()
- func (ob *Observer) DeleteBlockAndEvents(height int64) error
- func (ob *Observer) Fetch(startHeight int64)
- func (ob *Observer) GetCurrentBlockLog() (*model.BlockLog, error)
- func (ob *Observer) ProcessConfirmedEvent()
- func (ob *Observer) PruneBlocks()
- func (ob *Observer) SaveBlockAndEvents(blockLog *model.BlockLog, packages []interface{}) error
- func (ob *Observer) Start()
- func (ob *Observer) UpdateConfirmedNum(height int64) error
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 ¶
DeleteBlockAndEvents deletes the block and txs of the given height
func (*Observer) GetCurrentBlockLog ¶
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 ¶
SaveBlockAndEvents saves block and packages to database
func (*Observer) UpdateConfirmedNum ¶
UpdateConfirmedNum updates confirmation number of events
Click to show internal directories.
Click to hide internal directories.