Documentation
¶
Overview ¶
Package activity persists bus lifecycle events into the torrent_events table so the Activity page can render a full history (across restarts) instead of just the in-memory live stream.
What gets persisted: every event with an InfoHash, except the high-frequency health_update telemetry. The noise type is filtered here, not at the bus, since the live websocket stream still needs it for the dashboard gauges.
Failures are logged and swallowed — losing one row of activity history is not worth crashing a download for.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventRow ¶
type EventRow struct {
ID int64 `json:"id"`
InfoHash string `json:"info_hash"`
EventType string `json:"event_type"`
OccurredAt string `json:"occurred_at"` // RFC3339
Payload any `json:"payload"`
}
EventRow is a single row from the per-torrent event timeline. The payload column is delivered as raw JSON so the frontend can render whatever shape the producer emitted without us needing to model every event type.
type Item ¶
type Item struct {
InfoHash string `json:"info_hash"`
Name string `json:"name"`
Category string `json:"category"`
SavePath string `json:"save_path"`
SizeBytes int64 `json:"size_bytes"`
Resolution string `json:"resolution"`
AddedAt string `json:"added_at"` // RFC3339
CompletedAt string `json:"completed_at,omitempty"` // empty if still in progress
RemovedAt string `json:"removed_at,omitempty"` // empty if still active
Requester string `json:"requester,omitempty"`
MovieID string `json:"movie_id,omitempty"`
SeriesID string `json:"series_id,omitempty"`
EpisodeID string `json:"episode_id,omitempty"`
TMDBID int `json:"tmdb_id,omitempty"`
Season int `json:"season,omitempty"`
Episode int `json:"episode,omitempty"`
}
Item is a single row in the activity list. One row per torrent, including those that have been completed or removed — the table is the full history.
type ListFilter ¶
type ListFilter struct {
Search string // free-text matched against name + category (ILIKE)
Status string // "active" | "completed" | "removed" | "all" (default "all")
Sort string // "added_at" (default) | "completed_at" | "removed_at" | "size_bytes" | "resolution" | "name"
Order string // "asc" | "desc" (default "desc")
Limit int // default 50, cap 200
Offset int
}
ListFilter scopes a List query.
type Persister ¶
type Persister struct {
// contains filtered or unexported fields
}
Persister is a bus subscriber that writes lifecycle events to the torrent_events table.
func NewPersister ¶
NewPersister builds a Persister. Pass the result of its HandleEvent method to bus.Subscribe.