Documentation
¶
Overview ¶
Package broadcaster publishes events, which are changes, such as to a registry's providers, or its sessions, to the channels which watch it, so a server's clients see the changes as they happen
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broadcaster ¶
type Broadcaster struct {
// contains filtered or unexported fields
}
Broadcaster sends the events which are published to each channel which is watching it. It's watched from when it's made, until it stops running, and again when it runs again. It's safe to use concurrently.
func (*Broadcaster) Publish ¶
func (b *Broadcaster) Publish(event schema.Event)
Publish sends the event to each channel which is watching, which can receive it now. It never waits, so it can be called under a lock, which keeps the events in the order of the changes.
func (*Broadcaster) Run ¶
func (b *Broadcaster) Run(ctx context.Context) error
Run runs the broadcaster until the context is cancelled, when every watch ends, with ErrServiceUnavailable, as there will be no more events, such as when the server is stopping, and it isn't watched again until it runs again. It returns nil.
func (*Broadcaster) Watch ¶
Watch sends the events which are published to the channel, from when it returns, as it's watching before it does, until the context is cancelled, or the broadcaster stops running, as there will be no more events. It returns a channel which is sent nil when the context is cancelled, or ErrServiceUnavailable when the broadcaster stops running, once the watch has ended, after which no more events are sent to the channel, so it can be closed. A broadcaster which has stopped running isn't watched, and returns ErrServiceUnavailable, until it runs again. An event isn't waited for the channel to receive, so a channel which is full misses it, and one which needs every event should be buffered. Returns ErrBadParameter when there's no channel, and ErrConflict when the channel is watching already.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cmd has the broadcaster's commands and flags
|
Package cmd has the broadcaster's commands and flags |
|
Package httpclient is a client of the broadcaster's HTTP API
|
Package httpclient is a client of the broadcaster's HTTP API |
|
Package httphandler has the broadcaster's HTTP API, which streams its events to clients
|
Package httphandler has the broadcaster's HTTP API, which streams its events to clients |