Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForwardFromChannels ¶ added in v0.24.0
func ForwardFromChannels[R any](inputChannels []chan R, unsubscribed *atomic.Bool, onMessage func(R) error)
ForwardFromChannels - reads messages from the input channels, and calls the `onMessage` callback. Exits when the unsubscribed flag is true. Must be called as a go routine!
func HandleUnsubscribe ¶ added in v0.24.0
func HandleUnsubscribe(connectionSub *rpc.Subscription, unsubscribed *atomic.Bool, onUnsub func())
HandleUnsubscribe - when the client calls "unsubscribe" or the subscription times out, it calls `onSub` Must be called as a go routine!
Types ¶
type Manager ¶
type Manager[T any] struct { // contains filtered or unexported fields }
Manager is a subscription manager - allows for thread-safe registering/unregistering subscribers of type T
func NewManager ¶
NewManager creates a new subscription manager
func (*Manager[T]) Subscribe ¶
func (m *Manager[T]) Subscribe(subscriber T) func()
Subscribe adds a new subscriber, returns an unsubscribe function
func (*Manager[T]) Subscribers ¶
func (m *Manager[T]) Subscribers() []T
Subscribers returns a list of all subscribers
type NewHeadsService ¶ added in v0.24.0
type NewHeadsService struct {
// contains filtered or unexported fields
}
NewHeadsService multiplexes new batch header messages from an input channel into multiple subscribers also handles unsubscribe Note: this is a service which must be Started and Stopped
func NewNewHeadsService ¶ added in v0.24.0
func NewNewHeadsService(inputCh chan *common.BatchHeader, convertToEthHeader bool, logger gethlog.Logger, onMessage func(*common.BatchHeader) error) *NewHeadsService
func (*NewHeadsService) HealthStatus ¶ added in v0.24.0
func (nhs *NewHeadsService) HealthStatus() host.HealthStatus
func (*NewHeadsService) RegisterNotifier ¶ added in v0.24.0
func (nhs *NewHeadsService) RegisterNotifier(notifier *rpc.Notifier, subscription *rpc.Subscription)
func (*NewHeadsService) Start ¶ added in v0.24.0
func (nhs *NewHeadsService) Start() error
func (*NewHeadsService) Stop ¶ added in v0.24.0
func (nhs *NewHeadsService) Stop() error