log

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: ISC Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchLogs

func FetchLogs(db *gorm.DB, query string, args ...interface{}) (logs []types.Log, err error)

func ListenerJobID

func ListenerJobID(listener Listener) interface{}

ListenerJobID returns the appropriate job ID for a listener

func NewBroadcaster

func NewBroadcaster(orm ORM, ethClient eth.Client, config Config) *broadcaster

NewBroadcaster creates a new instance of the broadcaster

func NewDecodingListener

func NewDecodingListener(codec eth.ContractCodec, nativeLogTypes map[common.Hash]interface{}, innerListener Listener) *decodingListener

NewDecodingListener creates a new decodingListener

func NewORM

func NewORM(db *gorm.DB) *orm

Types

type Broadcast

type Broadcast interface {
	DecodedLog() interface{}
	RawLog() types.Log
	SetDecodedLog(interface{})
	WasAlreadyConsumed() (bool, error)
	MarkConsumed() error
}

The Broadcast type wraps a models.Log but provides additional functionality for determining whether or not the log has been consumed and for marking the log as consumed

type Broadcaster

type Broadcaster interface {
	utils.DependentAwaiter
	Start() error
	Stop() error
	Register(address common.Address, listener Listener) (connected bool)
	Unregister(address common.Address, listener Listener)
}

The Broadcaster manages log subscription requests for the Seerlink node. Instead of creating a new subscription for each request, it multiplexes all subscriptions to all of the relevant contracts over a single connection and forwards the logs to the relevant subscribers.

type Config

type Config interface {
	BlockBackfillDepth() uint64
	TriggerFallbackDBPollInterval() time.Duration
}

type Listener

type Listener interface {
	OnConnect()
	OnDisconnect()
	HandleLog(lb Broadcast, err error)
	JobID() models.JobID
	JobIDV2() int32
	IsV2Job() bool
}

The Listener responds to log events through HandleLog, and contains setup/tear-down callbacks in the On* functions.

type ORM

type ORM interface {
	UpsertLog(log types.Log) error
	UpsertBroadcastForListener(log types.Log, jobID interface{}) error
	UpsertBroadcastsForListenerSinceBlock(blockNumber uint64, address common.Address, jobID interface{}) error
	WasBroadcastConsumed(blockHash common.Hash, logIndex uint, jobID interface{}) (bool, error)
	MarkBroadcastConsumed(blockHash common.Hash, logIndex uint, jobID interface{}) error
	UnconsumedLogsPriorToBlock(blockNumber uint64) ([]types.Log, error)
	DeleteLogAndBroadcasts(blockHash common.Hash, logIndex uint) error
	DeleteUnconsumedBroadcastsForListener(jobID interface{}) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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