Documentation
¶
Index ¶
- type DownloadJob
- type DownloadResult
- type Downloader
- type FileWriter
- type QueueManager
- func (m *QueueManager) Add(ctx context.Context, releaseID string, title string) (*domain.QueueItem, error)
- func (m *QueueManager) Cancel(id string) bool
- func (m *QueueManager) GetActiveItem() *domain.QueueItem
- func (m *QueueManager) GetAllItems() []*domain.QueueItem
- func (m *QueueManager) GetItem(ctx context.Context, id string) (*domain.QueueItem, bool)
- func (m *QueueManager) HydrateItem(ctx context.Context, item *domain.QueueItem) error
- func (m *QueueManager) Start(ctx context.Context)
- func (m *QueueManager) Stop()
- func (m *QueueManager) UpdateStatus(ctx context.Context, item *domain.QueueItem, status domain.JobStatus)
- type WriteRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DownloadJob ¶
type DownloadResult ¶
type DownloadResult struct {
Job DownloadJob
Error error
}
type Downloader ¶ added in v0.5.0
type Downloader struct {
// contains filtered or unexported fields
}
Downloader is the concrete implementation of the download engine.
func NewDownloader ¶ added in v0.5.0
func NewDownloader(ctx *app.Context, writer *FileWriter) *Downloader
func (*Downloader) RenderCLIProgress ¶ added in v0.5.0
func (s *Downloader) RenderCLIProgress(item *domain.QueueItem, speedMbps float64, final bool)
func (*Downloader) SetProgressHandler ¶ added in v0.5.0
func (s *Downloader) SetProgressHandler(fn func(*domain.QueueItem))
type FileWriter ¶
type FileWriter struct {
// contains filtered or unexported fields
}
func NewFileWriter ¶
func NewFileWriter() *FileWriter
func (*FileWriter) CloseAll ¶
func (fw *FileWriter) CloseAll()
func (*FileWriter) PreAllocate ¶
func (fw *FileWriter) PreAllocate(path string, size int64) error
type QueueManager ¶ added in v0.5.0
type QueueManager struct {
// contains filtered or unexported fields
}
func NewQueueManager ¶ added in v0.5.0
func NewQueueManager(app *app.Context, loadExisting bool) *QueueManager
Initializes a QueueManager Takes app.Context and loadExisting bool as parameters if loadExisting is true, will load pending items from the database if loadExisting is false, will skip the database lookup (for CLI mode)
func (*QueueManager) Add ¶ added in v0.5.0
func (m *QueueManager) Add(ctx context.Context, releaseID string, title string) (*domain.QueueItem, error)
Add creates a new domain.QueueItem and notifies the processor loop
func (*QueueManager) Cancel ¶ added in v0.5.0
func (m *QueueManager) Cancel(id string) bool
func (*QueueManager) GetActiveItem ¶ added in v0.5.0
func (m *QueueManager) GetActiveItem() *domain.QueueItem
GetActiveItem allows the UI to see what's currently running
func (*QueueManager) GetAllItems ¶ added in v0.5.0
func (m *QueueManager) GetAllItems() []*domain.QueueItem
GetAllItems returns a copy of the current queue slice.
func (*QueueManager) GetItem ¶ added in v0.5.0
GetItem searches the queue for a specific ID. Returns the item and 'true' if found, nil and 'false' otherwise.
func (*QueueManager) HydrateItem ¶ added in v0.5.0
func (*QueueManager) Start ¶ added in v0.5.0
func (m *QueueManager) Start(ctx context.Context)
func (*QueueManager) Stop ¶ added in v0.5.0
func (m *QueueManager) Stop()
func (*QueueManager) UpdateStatus ¶ added in v0.5.0
func (m *QueueManager) UpdateStatus(ctx context.Context, item *domain.QueueItem, status domain.JobStatus)
updateStatus changes the status and saves to DB immediately