fixup! wip: refactor: API

This commit is contained in:
Rob Watson 2025-05-11 06:14:17 +02:00
parent b8a77d9c6c
commit 977b6fe7d7
2 changed files with 12 additions and 12 deletions

View File

@ -58,7 +58,7 @@ func (b *Bus) Send(evt Event) {
select {
case ch <- evt:
default:
b.logger.Warn("Event dropped", "name", evt.name())
b.logger.Warn("Event dropped", "name", evt.EventName())
}
}
}

View File

@ -19,7 +19,7 @@ const (
// Event represents something which happened in the appllication.
type Event interface {
name() Name
EventName() Name
}
// AppStateChangedEvent is emitted when the application state changes.
@ -27,7 +27,7 @@ type AppStateChangedEvent struct {
State domain.AppState
}
func (e AppStateChangedEvent) name() Name {
func (e AppStateChangedEvent) EventName() Name {
return EventNameAppStateChanged
}
@ -36,7 +36,7 @@ type DestinationAddedEvent struct {
URL string
}
func (e DestinationAddedEvent) name() Name {
func (e DestinationAddedEvent) EventName() Name {
return EventNameDestinationAdded
}
@ -46,7 +46,7 @@ type AddDestinationFailedEvent struct {
Err error
}
func (e AddDestinationFailedEvent) name() Name {
func (e AddDestinationFailedEvent) EventName() Name {
return EventNameAddDestinationFailed
}
@ -56,7 +56,7 @@ type DestinationStreamExitedEvent struct {
Err error
}
func (e DestinationStreamExitedEvent) name() Name {
func (e DestinationStreamExitedEvent) EventName() Name {
return EventNameDestinationStreamExited
}
@ -66,7 +66,7 @@ type StartDestinationFailedEvent struct {
Message string
}
func (e StartDestinationFailedEvent) name() Name {
func (e StartDestinationFailedEvent) EventName() Name {
return EventNameStartDestinationFailed
}
@ -76,7 +76,7 @@ type DestinationRemovedEvent struct {
URL string
}
func (e DestinationRemovedEvent) name() Name {
func (e DestinationRemovedEvent) EventName() Name {
return EventNameDestinationRemoved
}
@ -87,7 +87,7 @@ type RemoveDestinationFailedEvent struct {
Err error
}
func (e RemoveDestinationFailedEvent) name() Name {
func (e RemoveDestinationFailedEvent) EventName() Name {
return EventNameRemoveDestinationFailed
}
@ -100,11 +100,11 @@ type FatalErrorOccurredEvent struct {
// OtherInstanceDetectedEvent is emitted when the app launches and detects another instance.
type OtherInstanceDetectedEvent struct{}
func (e OtherInstanceDetectedEvent) name() Name {
func (e OtherInstanceDetectedEvent) EventName() Name {
return EventNameOtherInstanceDetected
}
func (e FatalErrorOccurredEvent) name() Name {
func (e FatalErrorOccurredEvent) EventName() Name {
return "fatal_error_occurred"
}
@ -114,6 +114,6 @@ type MediaServerStartedEvent struct {
RTMPSURL string
}
func (e MediaServerStartedEvent) name() Name {
func (e MediaServerStartedEvent) EventName() Name {
return "media_server_started"
}