observer

package
v0.0.0-...-ef390af Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	StartHeight        int64
	ConfirmNum         int64
	FetchInterval      time.Duration
	BlockUpdateTimeout time.Duration
}

type Dependencies

type Dependencies struct {
	DB       *gorm.DB
	Recorder recorder.IRecorder
}

type Observer

type Observer struct {
	// contains filtered or unexported fields
}

func NewObserver

func NewObserver(c *Config, d *Dependencies) *Observer

NewObserver returns the observer instance

func (*Observer) Alert

func (o *Observer) Alert()

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

func (*Observer) DeleteBlock

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

func (*Observer) GetCurrentBlockLog

func (ob *Observer) GetCurrentBlockLog() (*block.Log, error)

GetCurrentBlockLog returns the highest block log

func (*Observer) Prune

func (ob *Observer) Prune()

Prune prunes the outdated blocks

func (*Observer) RecordBlockAndTxs

func (ob *Observer) RecordBlockAndTxs(b *common.Block) error

func (*Observer) Start

func (o *Observer) Start()

Start starts the routines of observer

func (*Observer) Update

func (ob *Observer) Update()

Update starts the main routine for updating blocks

Jump to

Keyboard shortcuts

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