Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenerJobID ¶ added in v0.10.3
func ListenerJobID(listener Listener) interface{}
ListenerJobID returns the appropriate job ID for a listener
func NewBroadcaster ¶
NewBroadcaster creates a new instance of the broadcaster
Types ¶
type AbigenContract ¶ added in v0.10.3
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(listener Listener, opts ListenerOpts) (connected bool, unsubscribe func())
}
The Broadcaster manages log subscription requests for the Chainlink 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(b Broadcast)
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 ListenerOpts ¶ added in v0.10.3
type ListenerOpts struct {
Contract AbigenContract
Logs []generated.AbigenLog
}