events

package
v0.0.0-...-7c12c5a Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2015 License: GPL-2.0, GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventCache

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

An EventCache buffers events for a Fireable All events are cached. Filtering happens on Flush

func NewEventCache

func NewEventCache(evsw Fireable) *EventCache

Create a new EventCache with an EventSwitch as backend

func (*EventCache) FireEvent

func (evc *EventCache) FireEvent(event string, data types.EventData)

Cache an event to be fired upon finality.

func (*EventCache) Flush

func (evc *EventCache) Flush()

Fire events by running evsw.FireEvent on all cached events. Blocks. Clears cached events

type EventSwitch

type EventSwitch struct {
	BaseService
	// contains filtered or unexported fields
}

func NewEventSwitch

func NewEventSwitch() *EventSwitch

func (*EventSwitch) AddListenerForEvent

func (evsw *EventSwitch) AddListenerForEvent(listenerID, event string, cb eventCallback)

func (*EventSwitch) FireEvent

func (evsw *EventSwitch) FireEvent(event string, data types.EventData)

func (*EventSwitch) OnStart

func (evsw *EventSwitch) OnStart() error

func (*EventSwitch) OnStop

func (evsw *EventSwitch) OnStop()

func (*EventSwitch) RemoveListener

func (evsw *EventSwitch) RemoveListener(listenerID string)

func (*EventSwitch) RemoveListenerForEvent

func (evsw *EventSwitch) RemoveListenerForEvent(event string, listenerID string)

type Eventable

type Eventable interface {
	SetFireable(Fireable)
}

reactors and other modules should export this interface to become eventable

type Fireable

type Fireable interface {
	FireEvent(event string, data types.EventData)
}

an event switch or cache implements fireable

Jump to

Keyboard shortcuts

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