events

package
v0.3.10-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

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

func NewEvent

func NewEvent() *Event

func (*Event) Notify

func (e *Event) Notify(eventtype EventType, value interface{}) (err error)

Notify subscribers that Subscribe specified event

func (*Event) NotifyAll

func (e *Event) NotifyAll() (errs []error)

Notify all event subscribers

func (*Event) NotifySubscriber

func (e *Event) NotifySubscriber(eventfunc EventFunc, value interface{})

func (*Event) Subscribe

func (e *Event) Subscribe(eventtype EventType, eventfunc EventFunc) Subscriber

adds a new subscriber to Event.

func (*Event) UnSubscribe

func (e *Event) UnSubscribe(eventtype EventType, subscriber Subscriber) (err error)

UnSubscribe removes the specified subscriber

type EventFunc

type EventFunc func(v interface{})

type EventType

type EventType int16
const (
	EventBlockPersistCompleted EventType = 0
	EventNewInventory          EventType = 1
	EventNodeDisconnect        EventType = 2
	EventConsensusMsgReceived  EventType = 3
	EventRelayMsgReceived      EventType = 4
	EventBlockSyncingFinished  EventType = 5
)

type Subscriber

type Subscriber chan interface{}

Jump to

Keyboard shortcuts

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