observer

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2023 License: LGPL-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.Config
	AscExecutor executor.AscExecutor
}

func NewObserver

func NewObserver(db *gorm.DB, cfg *util.Config, ascExecutor executor.AscExecutor) *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) DeleteBlockAndPackages

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

DeleteBlockAndPackages 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 ASC

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) SaveBlockAndPackages

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

SaveBlockAndPackages 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 cross-chain packages.

Jump to

Keyboard shortcuts

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