events

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2016 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncEventEmitter added in v0.7.0

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

AsyncEventEmitter is an implementation of both an EventRegistar and EventEmitter that emits events in their own go routine.

func (*AsyncEventEmitter) AddListener added in v0.7.0

func (a *AsyncEventEmitter) AddListener(l EventListener) bool

AddListener adds a listener to the EventEmitter. Events emitted on this emitter will be invoked on the listener. The return value indicates if the listener has been added or not. It can't be added if it is already added and therefore registered to receive events

func (*AsyncEventEmitter) EmitEvent added in v0.7.0

func (a *AsyncEventEmitter) EmitEvent(event Event)

EmitEvent will send the event to all registered listeners

func (*AsyncEventEmitter) RemoveListener added in v0.7.0

func (a *AsyncEventEmitter) RemoveListener(l EventListener) bool

RemoveListener removes a listener from the EventEmitter. Subsequent calls to EmitEvent will not cause HandleEvent to be called on this listener. The return value indicates if a listener has been removed or not. The listener can't be removed if it was not present before.

type Destroyed added in v0.4.0

type Destroyed struct{}

Destroyed is fired when ringpop has been destroyed and should not be responding to requests or lookup requests.

type Event

type Event interface{}

Event is an empty interface that is type switched when handeled.

type EventEmitter added in v0.7.0

type EventEmitter interface {
	// AddListener adds a listener that will be invoked when an evemit is
	// emitted via EmitEvent. The value returned indicates if the listener have
	// been added or not. The operation will not fail, but a listener will only
	// be added once.
	AddListener(EventListener) bool

	// RemoveListener removes a listener and prevents it being invoked in
	// subsequent emitted events. The return value indicates if a value has been
	// removed or not.
	RemoveListener(EventListener) bool

	// EmitEvent invokes all the listeners that are registered with the
	// EventEmitter
	EmitEvent(Event)
}

EventEmitter can add and remove listeners which will be invoked when an event is emitted.

type EventListener

type EventListener interface {
	HandleEvent(event Event)
}

An EventListener handles events given to it by the Ringpop, as well as forwarded events from the SWIM node contained by the ringpop. HandleEvent should be thread safe.

type LookupEvent

type LookupEvent struct {
	Key      string
	Duration time.Duration
}

A LookupEvent is sent when a lookup is performed on the Ringpop's ring

type LookupNEvent added in v0.6.0

type LookupNEvent struct {
	Key      string
	N        int
	Duration time.Duration
}

A LookupNEvent is sent when a lookupN is performed on the Ringpop's ring

type Ready added in v0.4.0

type Ready struct{}

Ready is fired when ringpop has successfully bootstrapped and is ready to receive requests and other method calls.

type RingChangedEvent

type RingChangedEvent struct {
	ServersAdded   []string
	ServersRemoved []string
}

A RingChangedEvent is sent when servers are added and/or removed from the ring

type RingChecksumEvent

type RingChecksumEvent struct {
	OldChecksum uint32
	NewChecksum uint32
}

RingChecksumEvent is sent when a server is removed or added and a new checksum for the ring is calculated

type SyncEventEmitter added in v0.7.0

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

SyncEventEmitter is an implementation of both an EventRegistar and EventEmitter that emits events in the calling go routine.

func (*SyncEventEmitter) AddListener added in v0.7.0

func (a *SyncEventEmitter) AddListener(l EventListener) bool

AddListener adds a listener to the EventEmitter. Events emitted on this emitter will be invoked on the listener. The return value indicates if the listener has been added or not. It can't be added if it is already added and therefore registered to receive events

func (*SyncEventEmitter) EmitEvent added in v0.7.0

func (a *SyncEventEmitter) EmitEvent(event Event)

EmitEvent will send the event to all registered listeners

func (*SyncEventEmitter) RemoveListener added in v0.7.0

func (a *SyncEventEmitter) RemoveListener(l EventListener) bool

RemoveListener removes a listener from the EventEmitter. Subsequent calls to EmitEvent will not cause HandleEvent to be called on this listener. The return value indicates if a listener has been removed or not. The listener can't be removed if it was not present before.

Directories

Path Synopsis
test

Jump to

Keyboard shortcuts

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