health

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package health finds problems that stop Pilot from working: library folders that are missing or low on space, and download clients or indexers that are missing or unreachable. Like Sonarr's System > Status health list.

Library checks are local and cheap, so they run on every Report. Connectivity checks call each enabled client and indexer, so they run on a schedule (and on demand) and Report returns the last result.

Index

Constants

View Source
const (
	SourceLibrary        = "library"
	SourceDownloadClient = "download_client"
	SourceIndexer        = "indexer"
)

Source groups issues by what they are about.

Variables

This section is empty.

Functions

This section is empty.

Types

type Issue

type Issue struct {
	Source  string `json:"source"`
	Level   Level  `json:"level"`
	Message string `json:"message"`
}

Issue is one problem.

type Level

type Level string

Level is how serious an issue is.

const (
	// LevelWarning means something may go wrong soon or for some items.
	LevelWarning Level = "warning"
	// LevelError means something is broken now.
	LevelError Level = "error"
)

type Lister

type Lister[T any] interface {
	List(ctx context.Context) ([]T, error)
	Test(ctx context.Context, id string) error
}

Lister is the part of the downloader and indexer services health uses.

type Report

type Report struct {
	Issues []Issue
	// ConnectivityCheckedAt is when clients and indexers were last tested.
	ConnectivityCheckedAt time.Time
}

Report is the current list of issues.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service runs health checks.

func NewService

func NewService(q db.Querier, clients Lister[downloader.Config], indexers Lister[indexer.Config]) *Service

NewService creates a Service.

func (*Service) CheckConnectivity

func (s *Service) CheckConnectivity(ctx context.Context)

CheckConnectivity tests every enabled download client and indexer and stores the result. Concurrent calls share one run.

func (*Service) Report

func (s *Service) Report(ctx context.Context) Report

Report returns library issues (checked now) plus the last connectivity result. If connectivity was never checked, it is checked first.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL