broker

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: MPL-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenericNotifier

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

GenericNotifier allows a process to send updates to many subscribers in an easy manner.

func NewGenericNotifier

func NewGenericNotifier() *GenericNotifier

NewGenericNotifier returns a generic notifier which can be used by a process to notify many subscribers when a specific update is triggered.

func (*GenericNotifier) Notify

func (g *GenericNotifier) Notify(msg interface{})

Notify allows the implementer to notify all subscribers with a specific update. There is no guarantee the order in which subscribers receive the message which is sent linearly.

func (*GenericNotifier) Run

func (g *GenericNotifier) Run(stopCh <-chan struct{})

Run is a long-lived process which handles updating subscribers as well as ensuring any update is sent to them. The passed stopCh is used to coordinate shutdown.

func (*GenericNotifier) WaitForChange

func (g *GenericNotifier) WaitForChange(timeout time.Duration) interface{}

WaitForChange allows a subscriber to wait until there is a notification change, or the timeout is reached. The function will block until one condition is met.

Jump to

Keyboard shortcuts

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