Documentation
¶
Index ¶
- type Deps
- type Handler
- func (h *Handler) HandleBackoff(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleBackoffByPrefix(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleConfigParsed(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleLocks(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleProviderTimeout(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleProviderTimeoutReset(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleProviders(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleScore(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleSearchTargets(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleState(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleStateStats(w http.ResponseWriter, r *http.Request)
- func (h *Handler) InvalidateStats()
- func (h *Handler) StatsInvalidator() StatsCacheInvalidator
- type LiveState
- type MetricsReader
- type QueryStore
- type StatsArrClient
- type StatsCacheInvalidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deps ¶
type Deps struct {
QueryDB QueryStore
CovDB api.CoverageStore
Metrics MetricsReader
State func() *LiveState
Configured func() bool
CountMissing func(ctx context.Context, cfg api.ConfigProvider, db api.CoverageStore, series []api.Series, movies []api.Movie) int
}
Deps holds all dependencies for the query handler family.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler holds all dependencies for the query handler family.
func (*Handler) HandleBackoff ¶
func (h *Handler) HandleBackoff(w http.ResponseWriter, r *http.Request)
HandleBackoff returns items currently in adaptive search backoff. GET /api/backoff
func (*Handler) HandleBackoffByPrefix ¶
func (h *Handler) HandleBackoffByPrefix(w http.ResponseWriter, r *http.Request)
HandleBackoffByPrefix returns backoff entries for media IDs matching a prefix. GET /api/backoff/prefix?type=episode&prefix=tvdb-81189-
func (*Handler) HandleConfigParsed ¶
func (h *Handler) HandleConfigParsed(w http.ResponseWriter, r *http.Request)
HandleConfigParsed returns the config as structured JSON. GET /api/config/parsed
func (*Handler) HandleLocks ¶
func (h *Handler) HandleLocks(w http.ResponseWriter, r *http.Request)
HandleLocks returns all manually locked media+language pairs. GET /api/locks
func (*Handler) HandleProviderTimeout ¶
func (h *Handler) HandleProviderTimeout(w http.ResponseWriter, r *http.Request)
HandleProviderTimeout returns provider timeout state for all providers. GET /api/providers/timeout
func (*Handler) HandleProviderTimeoutReset ¶
func (h *Handler) HandleProviderTimeoutReset(w http.ResponseWriter, r *http.Request)
HandleProviderTimeoutReset clears all provider timeout state and re-enables all providers. POST /api/providers/timeout/reset
func (*Handler) HandleProviders ¶
func (h *Handler) HandleProviders(w http.ResponseWriter, r *http.Request)
HandleProviders returns registered providers with enabled status. GET /api/providers
func (*Handler) HandleScore ¶
func (h *Handler) HandleScore(w http.ResponseWriter, r *http.Request)
HandleScore simulates scoring a subtitle against a video. POST /api/score with JSON body.
func (*Handler) HandleSearchTargets ¶
func (h *Handler) HandleSearchTargets(w http.ResponseWriter, r *http.Request)
HandleSearchTargets resolves subtitle targets for a media item without actually searching. Useful for debugging language rules. GET /api/search/targets?orig_lang=en&audio_langs=en,fr
func (*Handler) HandleState ¶
func (h *Handler) HandleState(w http.ResponseWriter, r *http.Request)
HandleState returns subtitle state with optional filters. GET /api/state?type=episode&lang=fr&provider=opensubtitles&limit=50
func (*Handler) HandleStateStats ¶
func (h *Handler) HandleStateStats(w http.ResponseWriter, r *http.Request)
HandleStateStats returns aggregate stats for the dashboard. GET /api/state/stats
func (*Handler) InvalidateStats ¶
func (h *Handler) InvalidateStats()
InvalidateStats marks the stats cache stale.
func (*Handler) StatsInvalidator ¶
func (h *Handler) StatsInvalidator() StatsCacheInvalidator
StatsInvalidator returns the statsCache as a StatsCacheInvalidator for use by the polling subsystem.
type LiveState ¶
type LiveState struct {
Cfg api.ConfigProvider
Engine api.SearchEngine
Sonarr StatsArrClient
Radarr StatsArrClient
Providers []api.Provider
}
LiveState holds the hot-reloadable runtime state needed by query handlers.
type MetricsReader ¶
type MetricsReader interface {
TotalSearches() int64
}
MetricsReader is the narrow interface for reading search metrics.
type QueryStore ¶
type QueryStore interface {
GetState(ctx context.Context, q *api.StateQuery) ([]api.StateEntry, error)
GetBackoffItems(ctx context.Context) ([]api.BackoffEntry, error)
GetBackoffByPrefix(ctx context.Context, mediaType api.MediaType, mediaIDPrefix string) ([]api.BackoffEntry, error)
GetManualLocks(ctx context.Context) ([]api.ManualLockEntry, error)
Stats(ctx context.Context) (downloads, attempts int, err error)
}
QueryStore documents the api.Store methods used by query handlers.
type StatsArrClient ¶
type StatsArrClient interface {
GetSeries(ctx context.Context) ([]api.Series, error)
GetMovies(ctx context.Context) ([]api.Movie, error)
}
StatsArrClient is the narrow interface consumed by the stats handler.
type StatsCacheInvalidator ¶
type StatsCacheInvalidator interface {
Invalidate()
}
StatsCacheInvalidator is the narrow interface for stats cache invalidation.