event

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2025 License: AGPL-3.0-or-later Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddDestinationFailedEvent

type AddDestinationFailedEvent struct {
	URL string
	Err error
}

AddDestinationFailedEvent is emitted when a destination fails to be added.

func (AddDestinationFailedEvent) EventName added in v0.0.10

func (e AddDestinationFailedEvent) EventName() Name

type AppStateChangedEvent

type AppStateChangedEvent struct {
	State domain.AppState
}

AppStateChangedEvent is emitted when the application state changes.

func (AppStateChangedEvent) EventName added in v0.0.10

func (e AppStateChangedEvent) EventName() Name

type Bus

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

Bus is an event bus.

func NewBus

func NewBus(logger *slog.Logger) *Bus

NewBus returns a new event bus.

func (*Bus) Deregister added in v0.0.10

func (b *Bus) Deregister(clientID ClientID)

Deregister deregisters a consumer for all events.

func (*Bus) Register

func (b *Bus) Register() (ClientID, <-chan Event)

Register registers a consumer for all events.

func (*Bus) Send

func (b *Bus) Send(evt Event)

Send sends an event to all registered consumers.

func (*Bus) SendTo added in v0.0.12

func (b *Bus) SendTo(clientID ClientID, evt Event)

SendTo sends an event to a specific consumer identified by clientID.

type ClientID added in v0.0.12

type ClientID string

ClientID is a unique identifier for a client.

func NewClientID added in v0.0.12

func NewClientID() ClientID

NewClientID generates a new unique client ID.

type Command

type Command interface {
	Name() string
}

Command is an interface for commands that can be triggered by the terminal user interface.

type CommandAddDestination

type CommandAddDestination struct {
	DestinationName string
	URL             string
}

CommandAddDestination adds a destination.

func (CommandAddDestination) Name

func (c CommandAddDestination) Name() string

Name implements the Command interface.

type CommandCloseOtherInstance

type CommandCloseOtherInstance struct{}

CommandCloseOtherInstance closes the other instance of the application.

func (CommandCloseOtherInstance) Name

Name implements the Command interface.

type CommandKillServer added in v0.0.10

type CommandKillServer struct{}

CommandKillServer kills the server.

func (CommandKillServer) Name added in v0.0.10

func (c CommandKillServer) Name() string

Name implements the Command interface.

type CommandListDestinations added in v0.0.12

type CommandListDestinations struct{}

CommandListDestinations lists all destinations.

func (CommandListDestinations) Name added in v0.0.12

Name implements the Command interface.

type CommandRemoveDestination

type CommandRemoveDestination struct {
	ID    uuid.UUID
	Force bool // Remove the destination even if it is running.
}

CommandRemoveDestination removes a destination.

func (CommandRemoveDestination) Name

Name implements the Command interface.

type CommandStartDestination

type CommandStartDestination struct {
	ID uuid.UUID
}

CommandStartDestination starts a destination.

func (CommandStartDestination) Name

Name implements the Command interface.

type CommandStopDestination

type CommandStopDestination struct {
	ID uuid.UUID
}

CommandStopDestination stops a destination.

func (CommandStopDestination) Name

func (c CommandStopDestination) Name() string

Name implements the Command interface.

type CommandUpdateDestination added in v0.0.12

type CommandUpdateDestination struct {
	ID              uuid.UUID
	DestinationName optional.V[string]
	URL             optional.V[string]
}

CommandUpdateDestination updates a destination.

func (CommandUpdateDestination) Name added in v0.0.12

Name implements the Command interface.

type DestinationAddedEvent

type DestinationAddedEvent struct {
	ID uuid.UUID
}

DestinationAddedEvent is emitted when a destination is successfully added.

func (DestinationAddedEvent) EventName added in v0.0.10

func (e DestinationAddedEvent) EventName() Name

type DestinationRemovedEvent

type DestinationRemovedEvent struct {
	ID uuid.UUID
}

DestinationRemovedEvent is emitted when a destination is successfully removed.

func (DestinationRemovedEvent) EventName added in v0.0.10

func (e DestinationRemovedEvent) EventName() Name

type DestinationStartedEvent added in v0.0.12

type DestinationStartedEvent struct {
	ID uuid.UUID
}

DestinationStartedEvent is emitted when a destination starts successfully.

func (DestinationStartedEvent) EventName added in v0.0.12

func (e DestinationStartedEvent) EventName() Name

type DestinationStoppedEvent added in v0.0.12

type DestinationStoppedEvent struct {
	ID uuid.UUID
}

DestinationStoppedEvent is emitted when a destination stops successfully.

func (DestinationStoppedEvent) EventName added in v0.0.12

func (e DestinationStoppedEvent) EventName() Name

type DestinationStreamExitedEvent

type DestinationStreamExitedEvent struct {
	ID   uuid.UUID
	Name string
	Err  error
}

DestinationStreamExitedEvent is emitted when a destination goes off-air unexpectedly.

func (DestinationStreamExitedEvent) EventName added in v0.0.10

func (e DestinationStreamExitedEvent) EventName() Name

type DestinationUpdatedEvent added in v0.0.12

type DestinationUpdatedEvent struct {
	ID uuid.UUID
}

DestinationUpdatedEvent is emitted when a destination is successfully updated.

func (DestinationUpdatedEvent) EventName added in v0.0.12

func (e DestinationUpdatedEvent) EventName() Name

type DestinationsListedEvent added in v0.0.12

type DestinationsListedEvent struct {
	Destinations []domain.Destination
}

DestinationsListedEvent is emitted when the list of destinations is successfully retrieved.

func (DestinationsListedEvent) EventName added in v0.0.12

func (e DestinationsListedEvent) EventName() Name

type Event

type Event interface {
	EventName() Name
}

Event represents something which happened in the appllication.

type FatalErrorOccurredEvent

type FatalErrorOccurredEvent struct {
	Message string
}

FatalErrorOccurredEvent is emitted when a fatal application error occurs.

func (FatalErrorOccurredEvent) EventName added in v0.0.10

func (e FatalErrorOccurredEvent) EventName() Name

type ListDestinationsFailedEvent added in v0.0.12

type ListDestinationsFailedEvent struct {
	Err error
}

ListDestinationsFailedEvent is emitted when the list of destinations fails to be retrieved.

func (ListDestinationsFailedEvent) EventName added in v0.0.12

func (e ListDestinationsFailedEvent) EventName() Name

type MediaServerStartedEvent

type MediaServerStartedEvent struct{}

MediaServerStartedEvent is emitted when the mediaserver component starts successfully.

func (MediaServerStartedEvent) EventName added in v0.0.10

func (e MediaServerStartedEvent) EventName() Name

type Name

type Name string
const (
	EventNameAppStateChanged         Name = "app_state_changed"
	EventNameDestinationsListed      Name = "destinations_listed"
	EventNameListDestinationsFailed  Name = "list_destinations_failed"
	EventNameDestinationAdded        Name = "destination_added"
	EventNameAddDestinationFailed    Name = "add_destination_failed"
	EventNameDestinationUpdated      Name = "destination_updated"
	EventNameUpdateDestinationFailed Name = "update_destination_failed"
	EventNameDestinationStreamExited Name = "destination_stream_exited"
	EventNameDestinationStarted      Name = "destination_started"
	EventNameStartDestinationFailed  Name = "start_destination_failed"
	EventNameDestinationStopped      Name = "destination_stopped"
	EventNameStopDestinationFailed   Name = "stop_destination_failed"
	EventNameDestinationRemoved      Name = "destination_removed"
	EventNameRemoveDestinationFailed Name = "remove_destination_failed"
	EventNameFatalErrorOccurred      Name = "fatal_error_occurred"
	EventNameOtherInstanceDetected   Name = "other_instance_detected"
	EventNameMediaServerStarted      Name = "media_server_started"
)

type OtherInstanceDetectedEvent

type OtherInstanceDetectedEvent struct{}

OtherInstanceDetectedEvent is emitted when the app launches and detects another instance.

func (OtherInstanceDetectedEvent) EventName added in v0.0.10

func (e OtherInstanceDetectedEvent) EventName() Name

type RemoveDestinationFailedEvent

type RemoveDestinationFailedEvent struct {
	ID  uuid.UUID
	Err error
}

RemoveDestinationFailedEvent is emitted when a destination fails to be removed.

func (RemoveDestinationFailedEvent) EventName added in v0.0.10

func (e RemoveDestinationFailedEvent) EventName() Name

type StartDestinationFailedEvent

type StartDestinationFailedEvent struct {
	ID  uuid.UUID
	Err error
}

StartDestinationFailedEvent is emitted when a destination fails to start.

func (StartDestinationFailedEvent) EventName added in v0.0.10

func (e StartDestinationFailedEvent) EventName() Name

type StopDestinationFailedEvent added in v0.0.12

type StopDestinationFailedEvent struct {
	ID  uuid.UUID
	Err error
}

StopDestinationFailedEvent is emitted when a destination fails to stop.

func (StopDestinationFailedEvent) EventName added in v0.0.12

func (e StopDestinationFailedEvent) EventName() Name

type UpdateDestinationFailedEvent added in v0.0.12

type UpdateDestinationFailedEvent struct {
	ID  uuid.UUID
	Err error
}

UpdateDestinationFailedEvent is emitted when a destination fails to be updated.

func (UpdateDestinationFailedEvent) EventName added in v0.0.12

func (e UpdateDestinationFailedEvent) EventName() Name

Jump to

Keyboard shortcuts

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