notifications

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package internal contains miscellaneous small components used internally by the Fleetspeak server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

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

A Dispatcher connects dispatches incoming notifications according to the client that they are for.

func NewDispatcher

func NewDispatcher() *Dispatcher

func (*Dispatcher) Dispatch

func (d *Dispatcher) Dispatch(id common.ClientID)

Dispatch sends a notification to the most recent registration for id. It is a no-op if there is already a notification pending for the id.

func (*Dispatcher) NotifyAll

func (d *Dispatcher) NotifyAll(ctx context.Context)

NotifyAll effectively dispatches to every client currently registered.

func (*Dispatcher) Register

func (d *Dispatcher) Register(id common.ClientID) (notice <-chan struct{}, fin func())

Register creates a registration for id. Once called, any call to Dispatch for id will cause a notification to passed through notice.

The registration will be cleared and noticed will be closed when fin is called, or if another registration for id is created.

type LocalListenerNotifier

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

LocalListenerNotifier is both a Listener and a Notifier. It self notifies to support streaming connections in a single server installation.

func (*LocalListenerNotifier) Address

func (n *LocalListenerNotifier) Address() string

func (*LocalListenerNotifier) NewMessageForClient

func (n *LocalListenerNotifier) NewMessageForClient(ctx context.Context, target string, id common.ClientID) error

func (*LocalListenerNotifier) Start

func (n *LocalListenerNotifier) Start() (<-chan common.ClientID, error)

func (*LocalListenerNotifier) Stop

func (n *LocalListenerNotifier) Stop()

type NoopListener

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

NoopListener implements notifications.Listener in a trivial way. It can be used as a listener when no listener is actually needed. i.e., when streaming connections are not being used.

func (*NoopListener) Address

func (l *NoopListener) Address() string

func (*NoopListener) Start

func (l *NoopListener) Start() (<-chan common.ClientID, error)

func (*NoopListener) Stop

func (l *NoopListener) Stop()

type NoopNotifier

type NoopNotifier struct{}

NoopNotifier implements notifications.Listener in a trivial way. It can be used as a Notifier when no Notifier is actually needed. i.e., when streaming connections are not being used.

func (NoopNotifier) NewMessageForClient

func (n NoopNotifier) NewMessageForClient(ctx context.Context, target string, id common.ClientID) error

Jump to

Keyboard shortcuts

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