watcher

package
v0.0.0-...-efbd42f Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	ID             string     `bson:"_id"`
	ChainID        uint16     `bson:"emitterChain"`
	EmitterAddress string     `bson:"emitterAddr"`
	Sequence       string     `bson:"sequence"`
	PhylaxSetIndex uint32     `bson:"phylaxSetIndex"`
	Vaa            []byte     `bson:"vaas"`
	IndexedAt      time.Time  `bson:"indexedAt"`
	Timestamp      *time.Time `bson:"timestamp"`
	UpdatedAt      *time.Time `bson:"updatedAt"`
	TxHash         string     `bson:"txHash"`
	Version        uint16     `bson:"version"`
	Revision       uint16     `bson:"revision"`
}

Event represents a database change.

type Watcher

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

Watcher represents a listener of database changes.

func NewWatcher

func NewWatcher(ctx context.Context, db *mongo.Database, dbName string, handler WatcherFunc, alertClient alert.AlertClient, metrics metrics.Metrics, logger *zap.Logger) *Watcher

NewWatcher creates a new database event watcher.

func (*Watcher) Start

func (w *Watcher) Start(ctx context.Context) error

Start executes database event consumption.

type WatcherFunc

type WatcherFunc func(context.Context, *Event)

WatcherFunc is a function to send database changes.

Jump to

Keyboard shortcuts

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