listener

package
v0.0.0-...-2646333 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package listener contains all the components for the events listener, which streams a list of future events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventListener

type EventListener struct {

	// EventRecvChan is the channel to send and receive Events
	EventRecvChan chan *model.Event

	// ActiveSubs is the list of active event subscriptions handled
	// by the watchers
	ActiveSubs []utils.WatcherSubscription

	Errors chan error
	// contains filtered or unexported fields
}

EventListener handles the listener stream for events

func NewEventListener

func NewEventListener(client bind.ContractBackend, watchers []model.ContractWatchers) *EventListener

NewEventListener creates a new EventListener given the address of the contract to listen to.

func (*EventListener) AddWatchers

func (l *EventListener) AddWatchers(w model.ContractWatchers) error

AddWatchers will add watchersto the listener. If the listener is already started, add to the list of watchers, start up with the watcher, and add it to the list of subscriptions in the listener. If the listener is not already started, will just be added to the list of watchers.

func (*EventListener) RemoveWatchers

func (l *EventListener) RemoveWatchers(w model.ContractWatchers) error

RemoveWatchers will remove given watcher from the listener. If the listener is already started, stop the watcher, removes the subscription, and removes from watcher list. If the listener is not already started, will just be removed from the list of watchers.

func (*EventListener) Start

func (l *EventListener) Start() ([]utils.WatcherSubscription, error)

Start starts up the event listener and watchers

func (*EventListener) Stop

func (l *EventListener) Stop(unsub bool) error

Stop shuts down the event listener and performs clean up

Jump to

Keyboard shortcuts

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