events

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2018 License: Apache-2.0 Imports: 2 Imported by: 154

README

events

import "github.com/tendermint/tendermint/libs/events"

Overview

Pub-Sub in go with event caching

Index

Package files

event_cache.go events.go

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 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 EventCallback

type EventCallback func(data EventData)

type EventData

type EventData interface {
}

Generic event data can be typed and registered with tendermint/go-amino via concrete implementation of this interface

type EventSwitch

type EventSwitch interface {
    cmn.Service
    Fireable

    AddListenerForEvent(listenerID, event string, cb EventCallback)
    RemoveListenerForEvent(event string, listenerID string)
    RemoveListener(listenerID string)
}
func NewEventSwitch
func NewEventSwitch() EventSwitch

type Eventable

type Eventable interface {
    SetEventSwitch(evsw EventSwitch)
}

reactors and other modules should export this interface to become eventable

type Fireable

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

an event switch or cache implements fireable


Generated by godoc2md

Documentation

Overview

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 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 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 EventCallback

type EventCallback func(data EventData)

type EventData

type EventData interface {
}

Generic event data can be typed and registered with tendermint/go-amino via concrete implementation of this interface

type EventSwitch

type EventSwitch interface {
	cmn.Service
	Fireable

	AddListenerForEvent(listenerID, event string, cb EventCallback)
	RemoveListenerForEvent(event string, listenerID string)
	RemoveListener(listenerID string)
}

func NewEventSwitch

func NewEventSwitch() EventSwitch

type Eventable

type Eventable interface {
	SetEventSwitch(evsw EventSwitch)
}

reactors and other modules should export this interface to become eventable

type Fireable

type Fireable interface {
	FireEvent(event string, data 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