Documentation
¶
Index ¶
- Variables
- func IsTemporarilyUnreachable(err error) bool
- type ConfigInstance
- type ConfigManager
- type Service
- func (s *Service) ClearInstanceCache(ctx context.Context, instanceName string)
- func (s *Service) DiscoverFileMetadata(ctx context.Context, filePath, relativePath, nzbName, libraryPath string) (*model.WebhookMetadata, error)
- func (s *Service) EnsureDownloadClientRegistration(ctx context.Context, altmountHost string, altmountPort int, urlBase string, ...) error
- func (s *Service) EnsureWebhookRegistration(ctx context.Context, altmountURL string, apiKey string) error
- func (s *Service) GetAllInstances() []*model.ConfigInstance
- func (s *Service) GetFirstAdminAPIKey(ctx context.Context) string
- func (s *Service) GetHealth(ctx context.Context) (map[string]any, error)
- func (s *Service) GetInstance(instanceType, instanceName string) *model.ConfigInstance
- func (s *Service) NoteImportFailure(ctx context.Context, downloadID, category string)
- func (s *Service) RegisterConfigChangeHandler(ctx context.Context, configManager *config.Manager)
- func (s *Service) RegisterInstance(ctx context.Context, arrURL, apiKey string) error
- func (s *Service) ResolveIndexerByDownloadID(ctx context.Context, downloadID string) (string, bool)
- func (s *Service) StartWorker(ctx context.Context) error
- func (s *Service) StopWorker(ctx context.Context)
- func (s *Service) TestConnection(ctx context.Context, instanceType, url, apiKey string) error
- func (s *Service) TestDownloadClientRegistration(ctx context.Context, altmountHost string, altmountPort int, urlBase string, ...) (map[string]string, error)
- func (s *Service) TriggerDownloadScan(ctx context.Context, instanceType string)
- func (s *Service) TriggerFileRescan(ctx context.Context, pathForRescan string, relativePath string, ...) error
- func (s *Service) TriggerScanForFile(ctx context.Context, filePath string) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrPathMatchFailed = model.ErrPathMatchFailed ErrEpisodeAlreadySatisfied = model.ErrEpisodeAlreadySatisfied ErrInstanceNotFound = model.ErrInstanceNotFound )
Functions ¶
func IsTemporarilyUnreachable ¶ added in v0.3.0
IsTemporarilyUnreachable reports whether err indicates the *arr was only temporarily unreachable — a network/transport failure (timeout, connection refused, DNS, TLS, etc.) or a 5xx server response — rather than a definitive answer about the release. Such errors must DEFER a repair (keep the file repair-pending so it self-heals when the *arr returns) instead of condemning the file as corrupted. starr surfaces non-2xx responses as a *starr.ReqError whose Code carries the HTTP status; transport failures surface as net.Error (often wrapped in *url.Error) or a context deadline.
Types ¶
type ConfigInstance ¶
type ConfigInstance = model.ConfigInstance
Re-export types for backward compatibility
type ConfigManager ¶
type ConfigManager = model.ConfigManager
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages Radarr, Sonarr, Lidarr, Readarr, and Whisparr instances for health monitoring and file repair
func NewService ¶
func NewService(configGetter config.ConfigGetter, configManager model.ConfigManager, userRepo *database.UserRepository, queueRepo *database.Repository) *Service
NewService creates a new arrs service for health monitoring and file repair
func (*Service) ClearInstanceCache ¶ added in v0.3.0
ClearInstanceCache clears all movie and series caches for a specific instance
func (*Service) DiscoverFileMetadata ¶ added in v0.3.0
func (s *Service) DiscoverFileMetadata(ctx context.Context, filePath, relativePath, nzbName, libraryPath string) (*model.WebhookMetadata, error)
DiscoverFileMetadata attempts to discover the rich metadata for a file through the appropriate ARR instance
func (*Service) EnsureDownloadClientRegistration ¶
func (s *Service) EnsureDownloadClientRegistration(ctx context.Context, altmountHost string, altmountPort int, urlBase string, apiKey string) error
EnsureDownloadClientRegistration ensures that AltMount is registered as a SABnzbd download client in all enabled ARR instances
func (*Service) EnsureWebhookRegistration ¶
func (s *Service) EnsureWebhookRegistration(ctx context.Context, altmountURL string, apiKey string) error
EnsureWebhookRegistration ensures that the AltMount webhook is registered in all enabled ARR instances
func (*Service) GetAllInstances ¶
func (s *Service) GetAllInstances() []*model.ConfigInstance
GetAllInstances returns all arrs instances from configuration
func (*Service) GetFirstAdminAPIKey ¶
GetFirstAdminAPIKey retrieves the API key of the first admin user
func (*Service) GetInstance ¶
func (s *Service) GetInstance(instanceType, instanceName string) *model.ConfigInstance
GetInstance returns a specific instance by type and name
func (*Service) NoteImportFailure ¶ added in v0.3.0
NoteImportFailure runs the importer-side failure breaker for a permanently failed *arr-originated download: counts the failure per target against the shared tracker and, at the queue_cleanup_max_failures threshold, unmonitors the target and removes the *arr queue record with blocklist-without-re-search (before the *arr's own failed-download handling can auto-re-search). See worker.HandleImportFailure.
func (*Service) RegisterConfigChangeHandler ¶ added in v0.3.0
RegisterConfigChangeHandler subscribes to config changes and starts/stops the queue cleanup worker when arrs.enabled or arrs.queue_cleanup_enabled flips.
func (*Service) RegisterInstance ¶
RegisterInstance attempts to automatically register an ARR instance
func (*Service) ResolveIndexerByDownloadID ¶ added in v0.3.0
ResolveIndexerByDownloadID looks up which indexer a download came from by querying the native queue of each configured Sportarr instance for the given download-client ID. Sportarr is not starr-compatible and never fires an OnGrab webhook, so this on-demand lookup (used at import time) is how its imports get attributed instead of falling back to "Unknown" in indexer health. Only Sportarr instances are queried — the other *arrs supply the indexer via webhook. Returns ("", false) when no Sportarr instance knows the ID.
func (*Service) StartWorker ¶
StartWorker starts the queue cleanup worker
func (*Service) StopWorker ¶
StopWorker stops the queue cleanup worker
func (*Service) TestConnection ¶
TestConnection tests the connection to an arrs instance
func (*Service) TestDownloadClientRegistration ¶
func (s *Service) TestDownloadClientRegistration(ctx context.Context, altmountHost string, altmountPort int, urlBase string, apiKey string) (map[string]string, error)
TestDownloadClientRegistration tests the connection from ARR instances back to AltMount
func (*Service) TriggerDownloadScan ¶
TriggerDownloadScan triggers the "Check For Finished Downloads" task in ARR instances
Directories
¶
| Path | Synopsis |
|---|---|
|
Package failures holds the in-memory per-target failure counts behind the arrs circuit breaker (arrs.queue_cleanup_max_failures).
|
Package failures holds the in-memory per-target failure counts behind the arrs circuit breaker (arrs.queue_cleanup_max_failures). |