broadcast

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package broadcast implements multi-listener broadcast channels. See https://github.com/dustin/go-broadcast for original implementation and example.

Package broadcast provides pubsub of messages over channels. A provider has a Broadcaster into which it Submits messages and into which subscribers Register to pick up those messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BroadcastMessage

type BroadcastMessage struct {
	Id     uuid.UUID
	Source BroadcastSource
	Type   string
	Data   interface{}
	Time   time.Time
}

type BroadcastSource added in v0.2.27

type BroadcastSource string
const (
	// OperatorSyncChannel is a broadcast channel type for operator status messages.
	OperatorSyncChannel BroadcastSource = "urn:meshery:operator:sync"
)

type Broadcaster

type Broadcaster interface {
	// Register a new channel to receive broadcasts
	Register(chan<- BroadcastMessage)
	// Unregister a channel so that it no longer receives broadcasts.
	Unregister(chan<- BroadcastMessage)
	// Shut this broadcaster down.
	Close() error
	// Submit a new object to all subscribers
	Submit(BroadcastMessage)
}

The Broadcaster interface describes the main entry points to broadcasters.

func NewBroadcaster

func NewBroadcaster(buflen int) Broadcaster

NewBroadcaster creates a new broadcaster with the given input channel buffer length.

Jump to

Keyboard shortcuts

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