events

package
v0.0.0-...-1abf0d1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package events - Pub-Sub in go with event caching

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventCallback

type EventCallback func(data EventData) error

type EventData

type EventData interface{}

EventData is a generic event data can be typed and registered with tendermint/go-amino via concrete implementation of this interface.

type EventSwitch

type EventSwitch interface {
	Fireable
	AddListenerForEvent(listenerID, eventValue string, cb EventCallback) error
}

EventSwitch is the interface for synchronous pubsub, where listeners subscribe to certain events and, when an event is fired (see Fireable), notified via a callback function.

Listeners are added by calling AddListenerForEvent function. They can be removed by calling either RemoveListenerForEvent or RemoveListener (for all events).

func NewEventSwitch

func NewEventSwitch() EventSwitch

type Eventable

type Eventable interface {
	SetEventSwitch(evsw EventSwitch)
}

Eventable is the interface reactors and other modules must export to become eventable.

type Fireable

type Fireable interface {
	FireEvent(eventValue string, data EventData)
}

Fireable is the interface that wraps the FireEvent method.

FireEvent fires an event with the given name and data.

Jump to

Keyboard shortcuts

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