events

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: CC0-1.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// LogsChSize is the size of channel listening to Logs types.
	LogsChSize = 5
	// NewHeadsChSize is the size of channel listening to NewHeads types.
	NewHeadsChSize = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EventBroker

type EventBroker struct {
	DebugInfo chan int
	// contains filtered or unexported fields
}

EventBroker offers support to manage types subscriptions and broadcast the incoming events to subscribed objects.

func NewEventBroker

func NewEventBroker() *EventBroker

NewEventBroker creates a new EventBroker object

func (*EventBroker) PublishLogs

func (eb *EventBroker) PublishLogs(l event.Logs)

PublishLogs provides publish API for logs types. Implements broker.Broker interface

func (*EventBroker) PublishNewHeads

func (eb *EventBroker) PublishNewHeads(b event.Block)

PublishNewHeads provides publish API for new block head types. Implements broker.Broker interface

func (*EventBroker) Start

func (eb *EventBroker) Start()

Start main loop of the EventBroker that receives and distributes the events.

func (*EventBroker) SubscribeLogs

func (eb *EventBroker) SubscribeLogs(opts request.LogSubscriptionOptions, ch chan event.Logs) broker.Subscription

SubscribeLogs creates a new subscription and signals the EventBroker subscription channel to handle the subscription map

func (*EventBroker) SubscribeNewHeads

func (eb *EventBroker) SubscribeNewHeads(ch chan event.Block) broker.Subscription

SubscribeNewHeads creates a new subscription and signals the EventBroker subscription channel to handle the subscription map

func (*EventBroker) UnsubscribeFromLogs

func (eb *EventBroker) UnsubscribeFromLogs(sub broker.Subscription)

UnsubscribeFromLogs signals the EventBroker's related channel to delete the subscription

func (*EventBroker) UnsubscribeFromNewHeads

func (eb *EventBroker) UnsubscribeFromNewHeads(sub broker.Subscription)

UnsubscribeFromNewHeads signals the EventBroker's related channel to delete the subscription

type EventSubscription

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

func (*EventSubscription) GetId

func (es *EventSubscription) GetId() broker.SubID

GetId returns identifier of the EventSubscription which implements broker.Subscription

func (*EventSubscription) GetLogsCh

func (es *EventSubscription) GetLogsCh() chan event.Logs

GetLogsCh returns the logs types channel of the EventSubscription which implements broker.Subscription

func (*EventSubscription) GetLogsSubOpts

func (es *EventSubscription) GetLogsSubOpts() request.LogSubscriptionOptions

GetLogsSubOpts returns log filters of the EventSubscription which implements broker.Subscription

func (*EventSubscription) GetNewHeadsCh

func (es *EventSubscription) GetNewHeadsCh() chan event.Block

GetNewHeadsCh returns the newHeads types channel of the EventSubscription which implements broker.Subscription

type Type

type Type byte
const (
	// UnknownSubscription indicates an unknown subscription type
	UnknownSubscription Type = iota
	// NewHeadsSubscription tracks the newly added block responses
	NewHeadsSubscription
	// LogsSubscription queries for new or removed (chain reorg) logs
	LogsSubscription
)

Jump to

Keyboard shortcuts

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