Documentation
¶
Overview ¶
Package downloader manages download client configurations and orchestrates adding releases to the appropriate download client.
Index ¶
- Variables
- type Config
- type CreateRequest
- type Service
- func (s *Service) Add(ctx context.Context, r plugin.Release, allowedIDs []string) (downloadClientID, clientItemID string, err error)
- func (s *Service) ClientFor(ctx context.Context, configID string) (plugin.DownloadClient, error)
- func (s *Service) Create(ctx context.Context, req CreateRequest) (Config, error)
- func (s *Service) Delete(ctx context.Context, id string) error
- func (s *Service) Get(ctx context.Context, id string) (Config, error)
- func (s *Service) List(ctx context.Context) ([]Config, error)
- func (s *Service) Test(ctx context.Context, id string) error
- func (s *Service) Update(ctx context.Context, id string, req UpdateRequest) (Config, error)
- type UpdateRequest
Constants ¶
This section is empty.
Variables ¶
var ErrNoCompatibleClient = errors.New("no enabled download client configured for this protocol")
ErrNoCompatibleClient is returned when no enabled client supports the release protocol.
var ErrNotFound = errors.New("download client not found")
ErrNotFound is returned when a download client config does not exist.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
ID string
Name string
Kind string // "qbittorrent", "transmission", etc.
Enabled bool
Priority int
Settings json.RawMessage
CreatedAt time.Time
UpdatedAt time.Time
}
Config is the domain representation of a stored download client configuration.
type CreateRequest ¶
type CreateRequest struct {
Name string
Kind string
Enabled bool
Priority int
Settings json.RawMessage
}
CreateRequest carries the fields needed to create a download client config.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages download client configuration and release submission.
func NewService ¶
NewService creates a new Service.
func (*Service) Add ¶
func (s *Service) Add(ctx context.Context, r plugin.Release, allowedIDs []string) (downloadClientID, clientItemID string, err error)
Add finds the first enabled download client that supports the release's protocol and submits the release. Returns the download client config ID and the client-assigned item ID.
func (*Service) ClientFor ¶
ClientFor returns a (cached) plugin.DownloadClient for the given config ID. Used by the queue service to communicate with a specific client.
type UpdateRequest ¶
type UpdateRequest = CreateRequest
UpdateRequest carries the fields needed to update a download client config.