chain_events

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Event event // singleton of type event

Functions

This section is empty.

Types

type GetEventTypes

type GetEventTypes func() ([]string, error)

type GormStore

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

func NewGormStore

func NewGormStore(db *gorm.DB) *GormStore

func (*GormStore) LockedStatus added in v0.6.1

func (s *GormStore) LockedStatus(fn func(status *ListenerStatus) error) error

LockedStatus runs a transaction on the database manipulating 'status' of type ListenerStatus. It takes a function 'fn' as argument. In the context of 'fn' 'status' is locked. Uses NOWAIT modifier on the lock so simultaneous requests can be ignored.

type Listener

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

func NewListener

func NewListener(
	logger *log.Logger,
	fc *client.Client,
	db Store,
	getTypes GetEventTypes,
	maxDiff uint64,
	interval time.Duration,
	startingHeight uint64,
) *Listener

func (*Listener) Start

func (l *Listener) Start() *Listener

func (*Listener) Stop

func (l *Listener) Stop()

type ListenerStatus

type ListenerStatus struct {
	gorm.Model
	LatestHeight uint64
}

func (ListenerStatus) TableName

func (ListenerStatus) TableName() string

type LockError added in v0.6.1

type LockError struct {
	Err error
}

func (*LockError) Error added in v0.6.1

func (e *LockError) Error() string

type Store

type Store interface {
	LockedStatus(func(*ListenerStatus) error) error
}

Store manages data regarding tokens.

Jump to

Keyboard shortcuts

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