Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bus ¶
type Bus struct {
// contains filtered or unexported fields
}
Bus is a simple in-process publish/subscribe event bus. Publish is non-blocking — each handler runs in its own goroutine. A panicking handler is recovered and logged; it does not affect other handlers.
func (*Bus) Publish ¶
Publish sends an event to all registered handlers asynchronously. It returns immediately; handlers run concurrently in separate goroutines. The context passed to handlers is detached from the caller's cancellation so that handlers are not aborted when the originating HTTP request ends.
type Event ¶
type Event struct {
Type Type `json:"type"`
Timestamp time.Time `json:"timestamp"`
MovieID string `json:"movie_id,omitempty"`
Data map[string]any `json:"data,omitempty"`
}
Event carries the context of something that happened.
type Type ¶
type Type string
Type identifies what happened.
const ( TypeMovieAdded Type = "movie_added" TypeMovieDeleted Type = "movie_deleted" TypeMovieUpdated Type = "movie_updated" TypeGrabStarted Type = "grab_started" TypeGrabFailed Type = "grab_failed" TypeDownloadDone Type = "download_done" TypeImportComplete Type = "import_complete" TypeImportFailed Type = "import_failed" TypeHealthIssue Type = "health_issue" TypeHealthOK Type = "health_ok" TypeTaskStarted Type = "task_started" TypeTaskFinished Type = "task_finished" TypeBulkSearchProgress Type = "bulk_search_progress" TypeBulkSearchComplete Type = "bulk_search_complete" )