Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlockNumberMod ¶
BlockNumberMod returns true if the block number % n is 0
Types ¶
type BlockOptions ¶
type BlockOptions struct { // Number returns true if the block with the given number should be handled Number func(number uint64) bool }
BlockOptions contains options to filter blocks
type Broadcaster ¶
type Broadcaster interface { // RegisterEventHandler registers the given handler for specific events based on the given filters. RegisterEventHandler(id string, chainID uint64, handler HandleEventFunc, opts EventOptions) (func(), error) // RegisterBlockHandler registers the given handler for blocks based on the given filters. RegisterBlockHandler(id string, chainID uint64, handler HandleBlockFunc, opts BlockOptions) (func(), error) // Start starts broadcasting on-chain data to subscribers Start(ctx context.Context) error // Stop stops broadcasting Stop() error // Healthcheck performs a healthcheck of a broadcaster Healthcheck(ctx context.Context) error }
Broadcaster represents a behavior of events broadcaster.
func NewSingleChain ¶
func NewSingleChain( logger logrus.FieldLogger, client Client, headStreamer HeadStreamer, opts Options, ) (Broadcaster, error)
NewSingleChain is the constructor of singleChainBroadcaster
type Client ¶
type Client interface { ethereum.LogFilterer ethereum.ChainReader }
Client represents the behavior of the on-chain data provider
type EventOptions ¶
type EventOptions struct { // Contracts contains contract addresses to listen events from. Contracts []common.Address // Event types to receive, with value filter for each field in the event // No filter or an empty filter for a given field position mean: all values allowed // the key should be a result of AbigenLog.Topic() call // topic => topicValueFilters LogsWithTopics map[common.Hash][][]common.Hash }
EventOptions contains options to filter events
type HandleBlockFunc ¶
HandleBlockFunc is the signature of a function to handle heads
type HandleEventFunc ¶
HandleEventFunc is the signature of a function to handle events
type HeadStreamer ¶
func NewLongPollingHeadStreamer ¶
func NewLongPollingHeadStreamer( logger logrus.FieldLogger, client Client, blockTime time.Duration, chainID uint64, ) HeadStreamer
func NewWSHeadStreamer ¶
func NewWSHeadStreamer( logger logrus.FieldLogger, client Client, chainID uint64, ) HeadStreamer
Source Files
¶
Click to show internal directories.
Click to hide internal directories.