observer

package
v0.0.0-...-32b5228 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: Apache-2.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

	StartHeight int64
	ConfirmNum  int64

	Config   *util.Config
	Executor executor.Executor
}

func NewObserver

func NewObserver(db *gorm.DB, startHeight, confirmNum int64, cfg *util.Config, executor executor.Executor) *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) DeleteBlockAndTxEvents

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

DeleteBlockAndTxEvents 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) Prune

func (ob *Observer) Prune()

Prune prunes the outdated blocks

func (*Observer) SaveBlockAndTxEvents

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

func (*Observer) Start

func (ob *Observer) Start()

Start starts the routines of observer

func (*Observer) UpdateSwapPairRegisterConfirmedNum

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

func (*Observer) UpdateSwapStartConfirmedNum

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

Jump to

Keyboard shortcuts

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