Documentation
¶
Index ¶
- func FetchLogs(db *gorm.DB, query string, args ...interface{}) (logs []types.Log, err error)
- func ListenerJobID(listener Listener) interface{}
- func NewBroadcaster(orm ORM, ethClient eth.Client, config Config) *broadcaster
- func NewDecodingListener(codec eth.ContractCodec, nativeLogTypes map[common.Hash]interface{}, ...) *decodingListener
- func NewORM(db *gorm.DB) *orm
- type Broadcast
- type Broadcaster
- type Config
- type Listener
- type ORM
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenerJobID ¶
func ListenerJobID(listener Listener) interface{}
ListenerJobID returns the appropriate job ID for a listener
func NewBroadcaster ¶
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
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 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
}