broadcaster

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broadcaster

type Broadcaster struct {
	brokers.Broker

	Manager *manager.Manager
	// contains filtered or unexported fields
}

Broadcaster receives events (Add, Update and Delete) sent by the controller and uses a Broker to publish those events.

func New

func New(config *rest.Config, broker brokers.Broker, syncPeriod time.Duration, serverPort int, metricsBindAddress string) *Broadcaster

New returns a new GameServer broadcaster It required a config to be passed to the GameServer controller and a broker that will be publishing messages

func (*Broadcaster) Build

func (b *Broadcaster) Build() error

Build will check for required broadcaster components e return error if the requirements are not satisfied

func (*Broadcaster) OnAdd

func (b *Broadcaster) OnAdd(obj interface{}) error

OnAdd is the event handler that reacts to Add events

func (*Broadcaster) OnDelete

func (b *Broadcaster) OnDelete(obj interface{}) error

OnDelete is the event handler that reacts to Delete events

func (*Broadcaster) OnUpdate

func (b *Broadcaster) OnUpdate(oldObj interface{}, newObj interface{}) error

OnUpdate is the event handler that reacts to Update events

func (*Broadcaster) Publish

func (b *Broadcaster) Publish(event events.Event) error

Publish will publish the event wrapped on a envelope using the broker available

func (*Broadcaster) Start

func (b *Broadcaster) Start(ctx context.Context) error

Start run the controller that sends events back to the broadcaster event handlers

func (*Broadcaster) WithWatcherFor

func (b *Broadcaster) WithWatcherFor(obj client.Object) *Broadcaster

WithWatcherFor adds a controller for the specified obj. The controller reports back to the broadcaster events of type OnAdd, OnUpdate and OnDelete associated to that particular resource type. Examples of obj arguments are: &v1.GameServer and &v1.Fleet

Jump to

Keyboard shortcuts

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