Documentation
¶
Overview ¶
Package queue tracks active downloads and synchronises their status with the download clients.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DownloaderClient ¶
type DownloaderClient interface {
ClientFor(ctx context.Context, configID string) (plugin.DownloadClient, error)
}
DownloaderClient is the minimal interface the queue service needs from the downloader service — just enough to talk to specific clients.
type Item ¶
type Item struct {
GrabID string
SeriesID string
EpisodeID string // empty for season-pack grabs
ReleaseTitle string
Protocol string
Size int64
DownloadedBytes int64
Status string
ClientItemID string
DownloadClientID string
GrabbedAt time.Time
}
Item is the queue-service view of an active download, enriching the raw plugin.QueueItem with grab_history context.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service polls download clients and keeps grab_history status up to date.
func NewService ¶
func NewService(q db.Querier, downloader DownloaderClient, bus *events.Bus, logger *slog.Logger) *Service
NewService creates a new queue Service.
func (*Service) GetQueue ¶
GetQueue returns all active downloads (those with a client_item_id that are not yet completed, failed, or removed) using the status cached in grab_history.
func (*Service) GetQueueItem ¶
GetQueueItem returns a single active queue item by its grab ID. Returns an error if the item is not found.
func (*Service) PollAndUpdate ¶
PollAndUpdate fetches the current status of every active download from its download client and updates grab_history. Fires events for transitions to completed or failed.