chanotify

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2016 License: Apache-2.0, CC-BY-SA-4.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 Notifier

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

Notifier can effectively notify you about receiving from particular channels. It operates with pairs <-chan struct{} <-> string which is notification channel and its identificator respectively. Notification channel is <-chan struc{}, each send to which is spawn notification from Notifier, close doesn't spawn anything and removes channel from Notifier.

func New

func New() *Notifier

New returns a new notifier. A notifier must be closed by calling, (*Notifier).Close, once it is no longer in use.

func (*Notifier) Add

func (n *Notifier) Add(id interface{}, ch <-chan struct{}) error

Add adds new notification channel to the notifier. Multiple registrations of the same ID is not allowed.

func (*Notifier) Chan

func (n *Notifier) Chan() <-chan interface{}

Chan returns channel on which client listen for notifications. IDs of notifications is sent to the returned channel.

func (*Notifier) Close

func (n *Notifier) Close()

Close closes the notifier and releases its underlying resources.

Jump to

Keyboard shortcuts

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