app

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IndexingRecoveryProfileHeaderOnly = "header_only"
	IndexingRecoveryProfileBalanced   = "balanced"
	IndexingRecoveryProfileExhaustive = "exhaustive"
)

Variables

This section is empty.

Functions

func ApplyToConfig added in v0.6.1

func ApplyToConfig(base *config.Config, runtime *RuntimeSettings) *config.Config

ApplyToConfig applies runtime-editable settings on top of bootstrap config.

func EffectiveBackfillUntilDateByGroup added in v0.8.0

func EffectiveBackfillUntilDateByGroup(indexing *IndexingRuntimeSettings) map[string]string

func EffectiveNewsgroupNames added in v0.8.0

func EffectiveNewsgroupNames(indexing *IndexingRuntimeSettings) []string

func IndexingRecoveryProfileUsesYEnc added in v0.9.0

func IndexingRecoveryProfileUsesYEnc(value string) bool

func NormalizeIndexingRecoveryProfile added in v0.9.0

func NormalizeIndexingRecoveryProfile(value string) string

func RuntimeConfigured added in v0.7.1

func RuntimeConfigured(in *RuntimeSettings) bool

func ToConfigServers added in v0.7.1

func ToConfigServers(servers []ServerRuntimeSettings) []config.ServerConfig

func ValidateDownloadClients added in v0.9.0

func ValidateDownloadClients(clients []DownloadClientRuntimeSettings) error

Types

type AggregatorDownloadResult added in v0.6.1

type AggregatorDownloadResult struct {
	Release     *domain.Release
	Reader      io.ReadCloser
	RedirectURL string
}

type AggregatorModule added in v0.6.1

type AggregatorModule interface {
	Search(ctx context.Context, req SearchRequest) ([]*domain.Release, error)
	PrepareDownload(ctx context.Context, id string) (*AggregatorDownloadResult, error)
}

type AggregatorRuntimeSettings added in v0.7.1

type AggregatorRuntimeSettings struct {
	Sources AggregatorSourcesRuntimeSettings `json:"sources,omitempty"`
}

type AggregatorSourcesRuntimeSettings added in v0.7.1

type AggregatorSourcesRuntimeSettings struct {
	LocalBlob     RuntimeToggle `json:"local_blob,omitempty"`
	UsenetIndexer RuntimeToggle `json:"usenet_indexer,omitempty"`
	GoNZBNet      RuntimeToggle `json:"gonzbnet,omitempty"`
}

type BlobStore added in v0.6.0

type BlobStore interface {
	// Blobs: File System
	GetObjectReader(key string) (io.ReadCloser, error)
	CreateObjectWriter(key string) (io.WriteCloser, error)
	SaveObjectAtomically(key string, data []byte) error
	ExistsObject(key string) bool
	GetNZBReader(key string) (io.ReadCloser, error)
	CreateNZBWriter(key string) (io.WriteCloser, error)
	SaveNZBAtomically(key string, data []byte) error
	Exists(key string) bool
}

type Context

type Context struct {
	BootstrapConfig *config.Config
	Config          *config.Config
	Logger          *logger.Logger

	DisableReleasePurgeArchivedSources bool

	// High-level interfaces for services to use
	NNTP                      NNTPManager
	Aggregator                IndexerAggregator
	Resolver                  ReleaseResolver
	UsenetIndexer             UsenetIndexerService
	DownloadClient            DownloadClient
	JobStore                  JobStore
	BlobStore                 BlobStore
	IndexerArchiveStore       BlobStore
	PayloadFetcher            PayloadFetcher
	PayloadCacheStore         PayloadCacheStore
	SettingsStore             SettingsStore
	PGIndexStore              UsenetIndexStore
	AggregatorModule          AggregatorModule
	SettingsAdmin             SettingsAdmin
	UploaderStore             uploader.Store
	Uploader                  *uploader.Service
	UploaderFederationBackend uploader.FederationBackend
	UploaderFederation        *uploader.FederationService
	GoNZBNetPeerTransport     http.RoundTripper
	GoNZBNetTraversal         GoNZBNetTraversalTransport
	// contains filtered or unexported fields
}

Context hold the core environment and shared resources for GoNZB. It acts as the "Single Source of Truth" for the application state.

func NewContext

func NewContext(cfg *config.Config, log *logger.Logger) (*Context, error)

NewContext returns the shared application container. Concrete runtime construction lives in internal/runtime/wiring.

func (*Context) AddCloser added in v0.6.0

func (ctx *Context) AddCloser(c io.Closer)

allow runtime wiring (from main) to register additional closers.

func (*Context) Close added in v0.5.0

func (ctx *Context) Close()

func (*Context) CurrentConfig added in v0.6.1

func (ctx *Context) CurrentConfig() *config.Config

func (*Context) RegisterRuntimeModules added in v0.6.1

func (ctx *Context) RegisterRuntimeModules(modules ...RuntimeModule)

func (*Context) RuntimeModule added in v0.6.1

func (ctx *Context) RuntimeModule(name string) RuntimeModule

func (*Context) RuntimeModules added in v0.6.1

func (ctx *Context) RuntimeModules() []RuntimeModule

type ControlPlaneCapabilities added in v0.7.1

type ControlPlaneCapabilities struct {
	Modules  map[string]ModuleCapability `json:"modules"`
	Settings SettingsCapability          `json:"settings"`
	Revision int64                       `json:"revision,omitempty"`
}

type DownloadClient added in v0.9.0

type DownloadClient interface {
	SendRelease(ctx context.Context, submission DownloadClientSubmission) (*DownloadClientResult, error)
	Test(ctx context.Context, client DownloadClientRuntimeSettings) error
}

type DownloadClientResult added in v0.9.0

type DownloadClientResult struct {
	ClientID string `json:"client_id"`
	JobID    string `json:"job_id,omitempty"`
}

type DownloadClientRuntimeSettings added in v0.9.0

type DownloadClientRuntimeSettings struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Enabled  bool   `json:"enabled"`
	Default  bool   `json:"default"`
	BaseURL  string `json:"base_url"`
	APIKey   string `json:"api_key"`
	Category string `json:"category,omitempty"`
	Priority int    `json:"priority"`
}

type DownloadClientSubmission added in v0.9.0

type DownloadClientSubmission struct {
	SourceKind string
	ReleaseID  string
}

type GoNZBNetRuntimeSettings added in v0.9.0

type GoNZBNetRuntimeSettings struct {
	NodeAlias                      string   `json:"node_alias"`
	AdvertiseURL                   string   `json:"advertise_url"`
	AllowInsecurePeerHTTP          bool     `json:"allow_insecure_peer_http"`
	PublishPoolIDs                 []string `json:"publish_pool_ids"`
	ManualPeers                    []string `json:"manual_peers"`
	Visibility                     string   `json:"visibility"`
	AllowPoolCreation              bool     `json:"allow_pool_creation"`
	AllowJoinRequests              bool     `json:"allow_join_requests"`
	AdmissionRelayEnabled          bool     `json:"admission_relay_enabled"`
	ConsumerEnabled                bool     `json:"consumer_enabled"`
	ScannerEnabled                 bool     `json:"scanner_enabled"`
	IndexProjectionEnabled         bool     `json:"index_projection_enabled"`
	ManifestBuilderEnabled         bool     `json:"manifest_builder_enabled"`
	ManifestCacheEnabled           bool     `json:"manifest_cache_enabled"`
	ValidatorEnabled               bool     `json:"validator_enabled"`
	HealthCheckerEnabled           bool     `json:"health_checker_enabled"`
	CoverageEnabled                bool     `json:"coverage_enabled"`
	SchedulerEnabled               bool     `json:"scheduler_enabled"`
	PublishReleaseCardsEnabled     bool     `json:"publish_release_cards_enabled"`
	PublishReleaseCardsBatchSize   int      `json:"publish_release_cards_batch_size"`
	PublishReleaseCardsIntervalMin float64  `json:"publish_release_cards_interval_minutes"`
	ManifestAvailabilityEnabled    bool     `json:"manifest_availability_enabled"`
	HealthAttestationsEnabled      bool     `json:"health_attestations_enabled"`
	HealthAttestationsBatchSize    int      `json:"health_attestations_batch_size"`
	HealthAttestationsIntervalMin  float64  `json:"health_attestations_interval_minutes"`
	ScannerMaxGroups               int      `json:"scanner_max_groups"`
	ScannerMaxArticlesPerHour      int64    `json:"scanner_max_articles_per_hour"`
	ScannerClaimTTLMinutes         int      `json:"scanner_claim_ttl_minutes"`
	ScannerCheckpointIntervalSecs  int      `json:"scanner_checkpoint_interval_seconds"`
	ScannerRespectRemoteClaims     bool     `json:"scanner_respect_remote_claims"`
	ScannerAllowUnassignedWork     bool     `json:"scanner_allow_unassigned_work"`
	CoverageMode                   string   `json:"coverage_mode"`
	CoverageMinTrustForClaim       float64  `json:"coverage_min_trust_for_claim"`
	CoverageValidationOverlapPct   int      `json:"coverage_validation_overlap_percent"`
	CoverageStaleClaimPenalty      bool     `json:"coverage_stale_claim_penalty"`
	CoverageProviderScopeMode      string   `json:"coverage_provider_scope_mode"`
	ValidationBatchSize            int      `json:"validation_batch_size"`
	ValidationIntervalMin          float64  `json:"validation_interval_minutes"`
	ValidationTiers                []string `json:"validation_tiers"`
	ValidationMaxManifestsPerHour  int      `json:"validation_max_manifests_per_hour"`
	ValidationSamplePercent        int      `json:"validation_sample_percent"`
	ValidationAllowSamplePayload   bool     `json:"validation_allow_sample_payload_fetch"`
	ValidationAllowPAR2            bool     `json:"validation_allow_par2_validation"`
	ValidationPublishProviderScope bool     `json:"validation_publish_provider_scope_hash"`
	ChecksumValidationEnabled      bool     `json:"checksum_validation_enabled"`
	ManifestCacheMaxBytes          int64    `json:"manifest_cache_max_bytes"`
	ManifestCacheTTLDays           int      `json:"manifest_cache_ttl_days"`
	ManifestCacheServeTrustedPools bool     `json:"manifest_cache_serve_to_trusted_pools"`
	PullSyncEnabled                bool     `json:"pull_sync_enabled"`
	PullSyncIntervalMin            float64  `json:"pull_sync_interval_minutes"`
	PushSyncEnabled                bool     `json:"push_sync_enabled"`
	PushSyncIntervalMin            float64  `json:"push_sync_interval_minutes"`
	PushSyncBatchSize              int      `json:"push_sync_batch_size"`
	WebSocketGossipEnabled         bool     `json:"websocket_gossip_enabled"`
	GossipIntervalMin              float64  `json:"gossip_interval_minutes"`
	GossipBatchSize                int      `json:"gossip_batch_size"`
	GossipTTL                      int      `json:"gossip_ttl"`
	GossipFanout                   int      `json:"gossip_fanout"`
	PeerExchangeEnabled            bool     `json:"peer_exchange_enabled"`
	BinaryEvidenceConsumeEnabled   bool     `json:"binary_evidence_consume_enabled"`
	BinaryEvidenceServeEnabled     bool     `json:"binary_evidence_serve_enabled"`
	BinaryEvidencePeerTimeoutSecs  int      `json:"binary_evidence_peer_timeout_seconds"`
	BinaryEvidencePeerFanout       int      `json:"binary_evidence_peer_fanout"`
	BinaryEvidenceYEncBatchSize    int      `json:"binary_evidence_yenc_batch_size"`
	BinaryEvidenceSegmentLimit     int      `json:"binary_evidence_segment_limit"`
	BinaryEvidenceMaxResponseBytes int      `json:"binary_evidence_max_response_bytes"`
	BinaryEvidenceCooldownMinutes  int      `json:"binary_evidence_circuit_breaker_cooldown_minutes"`
	RelayEnabled                   bool     `json:"relay_enabled"`
	MaxEventBytes                  int      `json:"max_event_bytes"`
	MaxManifestBytes               int      `json:"max_manifest_bytes"`
	ManifestFetchTimeoutSeconds    int      `json:"manifest_fetch_timeout_seconds"`
	MaxBatchEvents                 int      `json:"max_batch_events"`
	RateLimitEventsPerMinute       int      `json:"rate_limit_events_per_minute"`
	TimeToleranceSeconds           int      `json:"time_tolerance_seconds"`
	MaxEventAgeHours               int      `json:"max_event_age_hours"`
	NonceTTLSeconds                int      `json:"nonce_ttl_seconds"`
	ShareProviderBackbone          bool     `json:"share_provider_backbone_hash"`
	ShareSourceIndexer             bool     `json:"share_source_indexer_hash"`
}

GoNZBNetRuntimeSettings contains operational federation settings that can be safely persisted and applied without changing listener, database, protocol, network identity, or private-key bootstrap boundaries.

type GoNZBNetTraversalTransport added in v0.10.0

type GoNZBNetTraversalTransport interface {
	http.RoundTripper
	Start(context.Context) error
	SetHandler(http.Handler)
	Close() error
	CoordinatorStatus() []map[string]any
}

type IndexerAggregator added in v0.6.0

type IndexerAggregator interface {
	SearchAll(ctx context.Context, query string) ([]*domain.Release, error)
	SearchAllWithRequest(ctx context.Context, req SearchRequest) ([]*domain.Release, error)
	GetNZB(ctx context.Context, res *domain.Release) (io.ReadCloser, error)
	GetResultByID(ctx context.Context, id string) (*domain.Release, error)
}

IndexerAggregator defines release search and NZB retrieval for aggregator sources.

type IndexerRuntimeSettings added in v0.6.1

type IndexerRuntimeSettings struct {
	ID                    string   `json:"id"`
	BaseURL               string   `json:"base_url"`
	APIPath               string   `json:"api_path"`
	APIKey                string   `json:"api_key"`
	Redirect              bool     `json:"redirect"`
	AllowPrivateAddresses bool     `json:"allow_private_addresses"`
	AllowedCIDRs          []string `json:"allowed_cidrs"`
}

type IndexingDeferredBackfillRuntimeSettings added in v0.8.0

type IndexingDeferredBackfillRuntimeSettings struct {
	Enabled                  bool    `json:"enabled,omitempty"`
	MaxRangesPerRun          int     `json:"max_ranges_per_run,omitempty"`
	MaxArticlesPerRangeChunk int     `json:"max_articles_per_range_chunk,omitempty"`
	RunOnlyBelowQueueRatio   float64 `json:"run_only_below_queue_ratio,omitempty"`
}

type IndexingInspectRuntimeSettings added in v0.7.0

type IndexingInspectRuntimeSettings struct {
	WorkDir                  string   `json:"work_dir,omitempty"`
	WorkspaceBackend         string   `json:"workspace_backend,omitempty"`
	MemoryWorkDir            string   `json:"memory_work_dir,omitempty"`
	MaxBytes                 int64    `json:"max_bytes,omitempty"`
	MinBinaryBytes           int64    `json:"min_binary_bytes,omitempty"`
	MaxBinaryBytes           int64    `json:"max_binary_bytes,omitempty"`
	RequireExpectedFileCount bool     `json:"require_expected_file_count,omitempty"`
	BlockedMagicHex          []string `json:"blocked_magic_hex,omitempty"`
	MaxArchiveDepth          int      `json:"max_archive_depth,omitempty"`
	ToolTimeoutSecs          int      `json:"tool_timeout_seconds,omitempty"`
	FFmpegPath               string   `json:"ffmpeg_path,omitempty"`
	FFProbePath              string   `json:"ffprobe_path,omitempty"`
	SevenZipPath             string   `json:"seven_zip_path,omitempty"`
	UnrarPath                string   `json:"unrar_path,omitempty"`
	PAR2Path                 string   `json:"par2_path,omitempty"`
}

type IndexingMaintenanceTaskRuntimeSettings added in v0.8.0

type IndexingMaintenanceTaskRuntimeSettings struct {
	Enabled         bool   `json:"enabled,omitempty"`
	ScheduleEnabled bool   `json:"schedule_enabled,omitempty"`
	IntervalHours   int    `json:"interval_hours,omitempty"`
	BatchSize       int    `json:"batch_size,omitempty"`
	LastDryRunAt    string `json:"last_dry_run_at,omitempty"`
}

type IndexingMatchRuntimeSettings added in v0.7.0

type IndexingMatchRuntimeSettings struct {
	HighConfidenceThreshold     float64 `json:"high_confidence_threshold,omitempty"`
	ProbableConfidenceThreshold float64 `json:"probable_confidence_threshold,omitempty"`
	ArticleBucketSize           int64   `json:"article_bucket_size,omitempty"`
}

type IndexingMaterializedGroupRuntimeSettings added in v0.8.0

type IndexingMaterializedGroupRuntimeSettings struct {
	GroupName         string   `json:"group_name,omitempty"`
	Enabled           bool     `json:"enabled,omitempty"`
	BackfillUntilDate string   `json:"backfill_until_date,omitempty"`
	ProviderIDs       []string `json:"provider_ids,omitempty"`
	RuleIDs           []string `json:"rule_ids,omitempty"`
}

type IndexingMemoryGuardRuntimeSettings added in v0.8.0

type IndexingMemoryGuardRuntimeSettings struct {
	Enabled             bool    `json:"enabled,omitempty"`
	MinAvailableBytes   int64   `json:"min_available_bytes,omitempty"`
	MinAvailablePercent float64 `json:"min_available_percent,omitempty"`
	MinSwapFreeBytes    int64   `json:"min_swap_free_bytes,omitempty"`
}

type IndexingPartitionRuntimeSettings added in v0.9.0

type IndexingPartitionRuntimeSettings struct {
	PrecreateDaysAhead      int `json:"precreate_days_ahead,omitempty"`
	MaxNewSourceDaysPerPass int `json:"max_new_source_days_per_pass,omitempty"`
	DDLLockTimeoutSeconds   int `json:"ddl_lock_timeout_seconds,omitempty"`
}

type IndexingPreDBRuntimeSettings added in v0.7.0

type IndexingPreDBRuntimeSettings struct {
	Enabled            bool    `json:"enabled,omitempty"`
	IntervalMinutes    float64 `json:"interval_minutes,omitempty"`
	BatchSize          int     `json:"batch_size,omitempty"`
	BackoffSeconds     int     `json:"backoff_seconds,omitempty"`
	Provider           string  `json:"provider,omitempty"`
	BaseURL            string  `json:"base_url,omitempty"`
	FeedURL            string  `json:"feed_url,omitempty"`
	DumpURL            string  `json:"dump_url,omitempty"`
	HTTPTimeoutSeconds int     `json:"http_timeout_seconds,omitempty"`
	BackfillPageSize   int     `json:"backfill_page_size,omitempty"`
	MaxBackfillPages   int     `json:"max_backfill_pages,omitempty"`
}

type IndexingProviderGroupInventoryRuntimeSettings added in v0.8.0

type IndexingProviderGroupInventoryRuntimeSettings struct {
	ProviderID   string `json:"provider_id,omitempty"`
	ProviderName string `json:"provider_name,omitempty"`
	GroupName    string `json:"group_name,omitempty"`
	High         int64  `json:"high,omitempty"`
	Low          int64  `json:"low,omitempty"`
	Status       string `json:"status,omitempty"`
	ScannedAt    string `json:"scanned_at,omitempty"`
}

type IndexingRecoveryAdmissionRuntimeSettings added in v0.8.0

type IndexingRecoveryAdmissionRuntimeSettings struct {
	TargetHotLagHours             int `json:"target_hot_lag_hours,omitempty"`
	TargetWarmLagHours            int `json:"target_warm_lag_hours,omitempty"`
	SoftQueueHours                int `json:"soft_queue_hours,omitempty"`
	HardQueueMultiplier           int `json:"hard_queue_multiplier,omitempty"`
	AbsoluteHardQueueCap          int `json:"absolute_hard_queue_cap,omitempty"`
	EWMAWindowMinutes             int `json:"ewma_window_minutes,omitempty"`
	BootstrapProbesPerHour        int `json:"bootstrap_probes_per_hour,omitempty"`
	Priority0OverflowCap          int `json:"priority0_overflow_cap,omitempty"`
	Priority0ReservoirBatches     int `json:"priority0_reservoir_batches,omitempty"`
	NearTimeCohortBucketMinutes   int `json:"near_time_cohort_bucket_minutes,omitempty"`
	LatestReservePercent          int `json:"latest_reserve_percent,omitempty"`
	BalancedBodyRequestsPerHour   int `json:"balanced_body_requests_per_hour,omitempty"`
	ExhaustiveBodyRequestsPerHour int `json:"exhaustive_body_requests_per_hour,omitempty"`
	DiscoveryBodyRequestsPerHour  int `json:"discovery_body_requests_per_hour,omitempty"`
}

type IndexingReleaseRuntimeSettings added in v0.7.0

type IndexingReleaseRuntimeSettings struct {
	Enabled                                         bool    `json:"enabled,omitempty"`
	IntervalMinutes                                 float64 `json:"interval_minutes,omitempty"`
	BatchSize                                       int     `json:"batch_size,omitempty"`
	AutoReformBatchSize                             int     `json:"auto_reform_batch_size,omitempty"`
	BackoffSeconds                                  int     `json:"backoff_seconds,omitempty"`
	MinConfidence                                   float64 `json:"min_confidence,omitempty"`
	MinCompletionPct                                float64 `json:"min_completion_pct,omitempty"`
	MinExpectedFileCoveragePct                      float64 `json:"min_expected_file_coverage_pct,omitempty"`
	RequireExpectedFileCountForContextualObfuscated bool    `json:"require_expected_file_count_for_contextual_obfuscated,omitempty"`
	PublicMinMatchConfidence                        float64 `json:"public_min_match_confidence,omitempty"`
	PublicMinCompletionPct                          float64 `json:"public_min_completion_pct,omitempty"`
	PublicMinIdentityStatus                         string  `json:"public_min_identity_status,omitempty"`
	PublicRequireInspection                         bool    `json:"public_require_inspection,omitempty"`
	PublicRequireEnrichment                         bool    `json:"public_require_enrichment,omitempty"`
	PublicRequireClearTitle                         bool    `json:"public_require_clear_title,omitempty"`
	PublicRequirePayloadComplete                    bool    `json:"public_require_payload_complete,omitempty"`
	PublicRequireExpectedFileCountComplete          bool    `json:"public_require_expected_file_count_complete,omitempty"`
	PublicRequirePAR2                               bool    `json:"public_require_par2,omitempty"`
	PublicRequireNFO                                bool    `json:"public_require_nfo,omitempty"`
	PublicRequireSFV                                bool    `json:"public_require_sfv,omitempty"`
	RetainUntilExpectedFileCountComplete            bool    `json:"retain_until_expected_file_count_complete,omitempty"`
	RetainRequirePAR2                               bool    `json:"retain_require_par2,omitempty"`
	RetainRequireNFO                                bool    `json:"retain_require_nfo,omitempty"`
	RetainRequireSFV                                bool    `json:"retain_require_sfv,omitempty"`
	ReopenArchivedNZBOnReleaseChange                bool    `json:"reopen_archived_nzb_on_release_change,omitempty"`
}

type IndexingRetentionRuntimeSettings added in v0.8.0

type IndexingRetentionRuntimeSettings struct {
	RawStageHotHours                int  `json:"raw_stage_hot_hours,omitempty"`
	RawStageWarmHours               int  `json:"raw_stage_warm_hours,omitempty"`
	RawStageColdHours               int  `json:"raw_stage_cold_hours,omitempty"`
	FailedProbeHours                int  `json:"failed_probe_hours,omitempty"`
	ArchivedReleaseDetailGraceHours int  `json:"archived_release_detail_grace_hours,omitempty"`
	MetadataIncompleteReleaseHours  int  `json:"metadata_incomplete_release_hours,omitempty"`
	CreatePartitionsDaysBefore      int  `json:"create_partitions_days_before,omitempty"`
	CreatePartitionsDaysAhead       int  `json:"create_partitions_days_ahead,omitempty"`
	SourceSettleHours               int  `json:"source_settle_hours,omitempty"`
	NoYieldGraceDays                int  `json:"no_yield_grace_days,omitempty"`
	YEncTerminalAttempts            int  `json:"yenc_terminal_attempts,omitempty"`
	ExecuteOutcomePurge             bool `json:"execute_outcome_purge,omitempty"`
	PurgeDryRunDefault              bool `json:"purge_dry_run_default,omitempty"`
}

type IndexingRuntimeSettings added in v0.6.1

type IndexingRuntimeSettings struct {
	Newsgroups                  []string                                          `json:"newsgroups,omitempty"`
	BackfillUntilDateByGroup    map[string]string                                 `json:"backfill_until_date_by_group,omitempty"`
	RecoveryProfile             string                                            `json:"recovery_profile,omitempty"`
	ExplicitGroups              []IndexingScrapeGroupRuntimeSettings              `json:"explicit_groups"`
	WildcardRules               []IndexingWildcardRuleRuntimeSettings             `json:"wildcard_rules"`
	ProviderGroupInventory      []IndexingProviderGroupInventoryRuntimeSettings   `json:"provider_group_inventory"`
	MaterializedGroups          []IndexingMaterializedGroupRuntimeSettings        `json:"materialized_groups"`
	ScrapeTimeframes            []IndexingScrapeTimeframeRuntimeSettings          `json:"scrape_timeframes"`
	ScrapeLatest                IndexingStageRuntimeSettings                      `json:"scrape_latest,omitempty"`
	ScrapeBackfill              IndexingStageRuntimeSettings                      `json:"scrape_backfill,omitempty"`
	ScrapeTimeframe             IndexingStageRuntimeSettings                      `json:"scrape_timeframe,omitempty"`
	ScrapeDeferred              IndexingStageRuntimeSettings                      `json:"scrape_deferred,omitempty"`
	PosterMaterialize           IndexingStageRuntimeSettings                      `json:"poster_materialize,omitempty"`
	CrosspostPopularityRefresh  IndexingStageRuntimeSettings                      `json:"crosspost_popularity_refresh,omitempty"`
	ArticleCohortSchedule       IndexingStageRuntimeSettings                      `json:"article_cohort_schedule,omitempty"`
	Assemble                    IndexingStageRuntimeSettings                      `json:"assemble,omitempty"`
	RecoverYEnc                 IndexingStageRuntimeSettings                      `json:"recover_yenc,omitempty"`
	SourceWindow                IndexingSourceWindowRuntimeSettings               `json:"source_window,omitempty"`
	Retention                   IndexingRetentionRuntimeSettings                  `json:"retention,omitempty"`
	Partitions                  IndexingPartitionRuntimeSettings                  `json:"partitions,omitempty"`
	RecoveryAdmission           IndexingRecoveryAdmissionRuntimeSettings          `json:"recovery_admission,omitempty"`
	ScrapeTiers                 IndexingScrapeTierRuntimeSettings                 `json:"scrape_tiers,omitempty"`
	DeferredBackfill            IndexingDeferredBackfillRuntimeSettings           `json:"deferred_backfill,omitempty"`
	ReleaseSummaryRefresh       IndexingStageRuntimeSettings                      `json:"release_summary_refresh,omitempty"`
	Release                     IndexingReleaseRuntimeSettings                    `json:"release,omitempty"`
	ReleaseGenerateNZB          IndexingStageRuntimeSettings                      `json:"release_generate_nzb,omitempty"`
	ReleaseArchiveNZB           IndexingStageRuntimeSettings                      `json:"release_archive_nzb,omitempty"`
	ReleasePurgeArchivedSources IndexingStageRuntimeSettings                      `json:"release_purge_archived_sources,omitempty"`
	MaintenanceTasks            map[string]IndexingMaintenanceTaskRuntimeSettings `json:"maintenance_tasks,omitempty"`
	Match                       IndexingMatchRuntimeSettings                      `json:"match,omitempty"`
	Inspect                     IndexingInspectRuntimeSettings                    `json:"inspect,omitempty"`
	StorageGuard                IndexingStorageGuardRuntimeSettings               `json:"storage_guard,omitempty"`
	MemoryGuard                 IndexingMemoryGuardRuntimeSettings                `json:"memory_guard,omitempty"`
	InspectDiscovery            IndexingStageRuntimeSettings                      `json:"inspect_discovery,omitempty"`
	InspectPAR2                 IndexingStageRuntimeSettings                      `json:"inspect_par2,omitempty"`
	InspectNFO                  IndexingStageRuntimeSettings                      `json:"inspect_nfo,omitempty"`
	InspectArchive              IndexingStageRuntimeSettings                      `json:"inspect_archive,omitempty"`
	InspectPassword             IndexingStageRuntimeSettings                      `json:"inspect_password,omitempty"`
	InspectMedia                IndexingStageRuntimeSettings                      `json:"inspect_media,omitempty"`
	EnrichPreDB                 IndexingPreDBRuntimeSettings                      `json:"enrich_predb,omitempty"`
	EnrichTMDB                  IndexingTMDBRuntimeSettings                       `json:"enrich_tmdb,omitempty"`
}

func IndexingRuntimeFromConfig added in v0.7.0

func IndexingRuntimeFromConfig(cfg config.IndexingConfig) IndexingRuntimeSettings

type IndexingScrapeGroupRuntimeSettings added in v0.8.0

type IndexingScrapeGroupRuntimeSettings struct {
	GroupName         string `json:"group_name,omitempty"`
	Enabled           bool   `json:"enabled,omitempty"`
	BackfillUntilDate string `json:"backfill_until_date,omitempty"`
	Source            string `json:"source,omitempty"`
}

func EffectiveScrapeGroups added in v0.8.0

func EffectiveScrapeGroups(indexing *IndexingRuntimeSettings) []IndexingScrapeGroupRuntimeSettings

type IndexingScrapeTierRuntimeSettings added in v0.8.0

type IndexingScrapeTierRuntimeSettings struct {
	HotWindowMinutes          int  `json:"hot_window_minutes,omitempty"`
	WarmWindowMinutes         int  `json:"warm_window_minutes,omitempty"`
	ColdSampleHeaders         int  `json:"cold_sample_headers,omitempty"`
	MaxArticlesPerGroupWindow int  `json:"max_articles_per_group_window,omitempty"`
	AssembleBacklogHighWater  int  `json:"assemble_backlog_high_water,omitempty"`
	AssembleBacklogLowWater   int  `json:"assemble_backlog_low_water,omitempty"`
	AllowGlobalDailyGate      bool `json:"allow_global_daily_gate,omitempty"`
}

type IndexingScrapeTimeframeRuntimeSettings added in v0.9.0

type IndexingScrapeTimeframeRuntimeSettings struct {
	ID        string `json:"id,omitempty"`
	GroupName string `json:"group_name,omitempty"`
	StartDate string `json:"start_date,omitempty"`
	StartTime string `json:"start_time,omitempty"`
	EndDate   string `json:"end_date,omitempty"`
	EndTime   string `json:"end_time,omitempty"`
	Enabled   bool   `json:"enabled,omitempty"`
}

type IndexingSourceWindowRuntimeSettings added in v0.8.0

type IndexingSourceWindowRuntimeSettings struct {
	Enabled            bool `json:"enabled,omitempty"`
	WindowMinutes      int  `json:"window_minutes,omitempty"`
	BackfillWindowDays int  `json:"backfill_window_days,omitempty"`
	MaxOpenHeaders     int  `json:"max_open_headers,omitempty"`
	ResumeOpenHeaders  int  `json:"resume_open_headers,omitempty"`
	MaxBlockingYEnc    int  `json:"max_blocking_yenc,omitempty"`
	ResumeBlockingYEnc int  `json:"resume_blocking_yenc,omitempty"`
}

type IndexingStageRuntimeSettings added in v0.7.0

type IndexingStageRuntimeSettings struct {
	Enabled                 bool    `json:"enabled,omitempty"`
	IntervalMinutes         float64 `json:"interval_minutes,omitempty"`
	BatchSize               int     `json:"batch_size,omitempty"`
	MaxBatches              int     `json:"max_batches,omitempty"`
	Concurrency             int     `json:"concurrency,omitempty"`
	MaxEffectiveConcurrency int     `json:"max_effective_concurrency,omitempty"`
	BackoffSeconds          int     `json:"backoff_seconds,omitempty"`
	BinaryUpsertDBChunkSize int     `json:"binary_upsert_db_chunk_size,omitempty"`
	LaneATargetPct          int     `json:"lane_a_target_pct,omitempty"`
	LaneBMinPct             int     `json:"lane_b_min_pct,omitempty"`
	LaneATimeWindowMinutes  int     `json:"lane_a_time_window_minutes,omitempty"`
	TargetWindowEnabled     bool    `json:"target_window_enabled,omitempty"`
	TargetWindowStart       string  `json:"target_window_start,omitempty"`
	TargetWindowEnd         string  `json:"target_window_end,omitempty"`
	TargetWindowPct         int     `json:"target_window_pct,omitempty"`
	FetchTimeoutSeconds     int     `json:"fetch_timeout_seconds,omitempty"`
	NewestPct               int     `json:"newest_pct"`
}

type IndexingStorageGuardRuntimeSettings added in v0.8.0

type IndexingStorageGuardRuntimeSettings struct {
	Enabled        bool    `json:"enabled,omitempty"`
	DataDirectory  string  `json:"data_directory,omitempty"`
	MinFreeBytes   int64   `json:"min_free_bytes,omitempty"`
	MinFreePercent float64 `json:"min_free_percent,omitempty"`
}

type IndexingTMDBRuntimeSettings added in v0.7.0

type IndexingTMDBRuntimeSettings struct {
	Enabled            bool    `json:"enabled,omitempty"`
	IntervalMinutes    float64 `json:"interval_minutes,omitempty"`
	BatchSize          int     `json:"batch_size,omitempty"`
	BackoffSeconds     int     `json:"backoff_seconds,omitempty"`
	HTTPTimeoutSeconds int     `json:"http_timeout_seconds,omitempty"`
	TMDBAPIKey         string  `json:"tmdb_api_key,omitempty"`
	TMDBAccessToken    string  `json:"tmdb_access_token,omitempty"`
	TMDBBaseURL        string  `json:"tmdb_base_url,omitempty"`
	TVDBAPIKey         string  `json:"tvdb_api_key,omitempty"`
	TVDBPIN            string  `json:"tvdb_pin,omitempty"`
	TVDBBaseURL        string  `json:"tvdb_base_url,omitempty"`
}

type IndexingWildcardRuleRuntimeSettings added in v0.8.0

type IndexingWildcardRuleRuntimeSettings struct {
	ID      string `json:"id,omitempty"`
	Pattern string `json:"pattern,omitempty"`
	Enabled bool   `json:"enabled,omitempty"`
}

type JobStore added in v0.6.0

type JobStore interface {
	Ping(ctx context.Context) error
	SchemaVersion(ctx context.Context) (int, error)
	ExpectedSchemaVersion() int
	ValidateSchema(ctx context.Context) error
}

type ModuleCapability added in v0.7.1

type ModuleCapability struct {
	Enabled      bool     `json:"enabled"`
	Configured   bool     `json:"configured"`
	Ready        bool     `json:"ready"`
	Visible      bool     `json:"visible"`
	Reason       string   `json:"reason,omitempty"`
	Requirements []string `json:"requirements,omitempty"`
}

type NNTPManager

type NNTPManager interface {
	Close() error
}

type NNTPModuleRuntimeStats added in v0.8.0

type NNTPModuleRuntimeStats struct {
	IndexerActive int64 `json:"indexer_active"`
}

type NNTPPoolRuntimeSettings added in v0.8.0

type NNTPPoolRuntimeSettings struct {
	IndexerStageTargetPercent int `json:"indexer_stage_target_percent"`
}

func DefaultNNTPPoolRuntimeSettings added in v0.8.0

func DefaultNNTPPoolRuntimeSettings() *NNTPPoolRuntimeSettings

type NNTPProviderRuntimeStats added in v0.8.0

type NNTPProviderRuntimeStats struct {
	ID                string   `json:"id"`
	Label             string   `json:"label"`
	Roles             []string `json:"roles,omitempty"`
	Priority          int      `json:"priority"`
	Capacity          int      `json:"capacity"`
	Active            int      `json:"active"`
	Idle              int      `json:"idle"`
	Dials             int64    `json:"dials"`
	DialFailures      int64    `json:"dial_failures"`
	PoolReuses        int64    `json:"pool_reuses"`
	PoolReturns       int64    `json:"pool_returns"`
	PoolDiscardIdle   int64    `json:"pool_discard_idle"`
	PoolDiscardAge    int64    `json:"pool_discard_age"`
	PoolDiscardError  int64    `json:"pool_discard_error"`
	FetchRetries      int64    `json:"fetch_retries"`
	GroupStatsRetries int64    `json:"group_stats_retries"`
	XOverRetries      int64    `json:"xover_retries"`
	RecoverableErrors int64    `json:"recoverable_errors"`
}

type NNTPRuntimeStats added in v0.8.0

type NNTPRuntimeStats struct {
	Scope           string                     `json:"scope"`
	Policy          string                     `json:"policy"`
	Capacity        int                        `json:"capacity"`
	Active          int                        `json:"active"`
	Idle            int                        `json:"idle"`
	Waiting         int64                      `json:"waiting"`
	BusyReturns     int64                      `json:"busy_returns"`
	WaitCount       int64                      `json:"wait_count"`
	WaitDurationMS  int64                      `json:"wait_duration_ms"`
	WaitMaxMS       int64                      `json:"wait_max_ms"`
	Fetches         int64                      `json:"fetches"`
	FetchBodyPrefix int64                      `json:"fetch_body_prefix"`
	GroupStats      int64                      `json:"group_stats"`
	XOver           int64                      `json:"xover"`
	ArticleNotFound int64                      `json:"article_not_found"`
	OperationErrors int64                      `json:"operation_errors"`
	Modules         NNTPModuleRuntimeStats     `json:"modules"`
	Providers       []NNTPProviderRuntimeStats `json:"providers"`
	Scopes          []NNTPScopeRuntimeStats    `json:"scopes"`
}

type NNTPScopeRuntimeStats added in v0.8.0

type NNTPScopeRuntimeStats struct {
	Scope           string `json:"scope"`
	Active          int64  `json:"active"`
	Waiting         int64  `json:"waiting"`
	WaitCount       int64  `json:"wait_count"`
	WaitDurationMS  int64  `json:"wait_duration_ms"`
	WaitMaxMS       int64  `json:"wait_max_ms"`
	Fetches         int64  `json:"fetches"`
	FetchBodyPrefix int64  `json:"fetch_body_prefix"`
	GroupStats      int64  `json:"group_stats"`
	XOver           int64  `json:"xover"`
	ArticleNotFound int64  `json:"article_not_found"`
	OperationErrors int64  `json:"operation_errors"`
}

type PayloadCacheStore added in v0.6.0

type PayloadCacheStore interface {
	GetObjectReader(key string) (io.ReadCloser, error)
	CreateObjectWriter(key string) (io.WriteCloser, error)
	SaveObjectAtomically(key string, data []byte) error
	ExistsObject(key string) bool
	GetNZBReader(key string) (io.ReadCloser, error)
	CreateNZBWriter(key string) (io.WriteCloser, error)
	SaveNZBAtomically(key string, data []byte) error
	Exists(key string) bool
}

type PayloadFetcher added in v0.6.0

type PayloadFetcher interface {
	GetNZB(ctx context.Context, sourceKind string, res *domain.Release) (io.ReadCloser, error)
}

payload fetch now routes by persisted source kind.

type ReleaseResolver added in v0.6.0

type ReleaseResolver interface {
	GetRelease(ctx context.Context, sourceKind, sourceReleaseID string) (*domain.Release, error)
	GetNZB(ctx context.Context, sourceKind string, res *domain.Release) (io.ReadCloser, error)
}

resolver routes by source kind instead of assuming aggregator-only resolution.

type RuntimeCheck added in v0.6.1

type RuntimeCheck struct {
	Name   string
	OK     bool
	Detail string
}

type RuntimeModule added in v0.6.1

type RuntimeModule interface {
	Name() string
	Enabled() bool
	Build(ctx context.Context) error
	Start(ctx context.Context) error
	Reload(ctx context.Context) error
	Close() error
	ReadinessChecks(ctx context.Context) []RuntimeCheck
}

type RuntimeSettings added in v0.6.1

type RuntimeSettings struct {
	Servers         []ServerRuntimeSettings         `json:"servers,omitempty"`
	IndexerServers  []ServerRuntimeSettings         `json:"indexer_servers,omitempty"`
	Indexers        []IndexerRuntimeSettings        `json:"indexers,omitempty"`
	DownloadClients []DownloadClientRuntimeSettings `json:"download_clients,omitempty"`
	Aggregator      *AggregatorRuntimeSettings      `json:"aggregator,omitempty"`
	GoNZBNet        *GoNZBNetRuntimeSettings        `json:"gonzbnet,omitempty"`
	NNTPPool        *NNTPPoolRuntimeSettings        `json:"nntp_pool,omitempty"`
	Indexing        *IndexingRuntimeSettings        `json:"indexing,omitempty"`
	Revision        int64                           `json:"revision,omitempty"`
}

func ApplyPatch added in v0.6.1

func ApplyPatch(current *RuntimeSettings, patch *RuntimeSettingsPatch) *RuntimeSettings

ApplyPatch applies an incoming patch to the current runtime settings.

func CloneRuntimeSettings added in v0.6.1

func CloneRuntimeSettings(in *RuntimeSettings) *RuntimeSettings

CloneRuntimeSettings returns a deep copy of runtime settings.

func DefaultRuntimeSettings added in v0.7.1

func DefaultRuntimeSettings() *RuntimeSettings

func FromConfig added in v0.6.1

func FromConfig(cfg *config.Config) *RuntimeSettings

FromConfig derives editable runtime state from current effective config.

func RedactedCopy added in v0.6.1

func RedactedCopy(in *RuntimeSettings) *RuntimeSettings

RedactedCopy removes secrets before returning settings externally.

func WithRuntimeDefaults added in v0.7.1

func WithRuntimeDefaults(in *RuntimeSettings) *RuntimeSettings

func WithRuntimeDefaultsFromConfig added in v0.9.0

func WithRuntimeDefaultsFromConfig(in *RuntimeSettings, cfg *config.Config) *RuntimeSettings

WithRuntimeDefaultsFromConfig preserves bootstrap GoNZBNet behavior when an older persisted runtime snapshot predates the GoNZBNet settings section.

type RuntimeSettingsPatch added in v0.6.1

type RuntimeSettingsPatch struct {
	Servers         *[]ServerRuntimeSettings         `json:"servers,omitempty"`
	IndexerServers  *[]ServerRuntimeSettings         `json:"indexer_servers,omitempty"`
	Indexers        *[]IndexerRuntimeSettings        `json:"indexers,omitempty"`
	DownloadClients *[]DownloadClientRuntimeSettings `json:"download_clients,omitempty"`
	Aggregator      *AggregatorRuntimeSettings       `json:"aggregator,omitempty"`
	GoNZBNet        *GoNZBNetRuntimeSettings         `json:"gonzbnet,omitempty"`
	NNTPPool        *NNTPPoolRuntimeSettings         `json:"nntp_pool,omitempty"`
	Indexing        *IndexingRuntimeSettings         `json:"indexing,omitempty"`
}

type RuntimeToggle added in v0.7.1

type RuntimeToggle struct {
	Enabled bool `json:"enabled"`
}

type SearchRequest added in v0.6.1

type SearchRequest struct {
	Type string

	Query      string
	Categories []int
	Limit      int

	IMDbID   string
	TVDBID   string
	TVMazeID string
	RageID   string
	Season   string
	Episode  string
	Genre    string
}

type ServerRuntimeSettings added in v0.6.1

type ServerRuntimeSettings struct {
	ID                     string   `json:"id"`
	Host                   string   `json:"host"`
	Port                   int      `json:"port"`
	Username               string   `json:"username"`
	Password               string   `json:"password"`
	TLS                    bool     `json:"tls"`
	MaxConnection          int      `json:"max_connections"`
	Priority               int      `json:"priority"`
	DialTimeoutSeconds     int      `json:"dial_timeout_seconds"`
	TCPKeepAliveSeconds    int      `json:"tcp_keepalive_seconds"`
	PoolIdleTimeoutSeconds int      `json:"pool_idle_timeout_seconds"`
	PoolMaxAgeSeconds      int      `json:"pool_max_age_seconds"`
	EnablePoolLogging      bool     `json:"enable_pool_logging"`
	Roles                  []string `json:"roles,omitempty"`
}

func IndexerNNTPServers added in v0.7.1

func IndexerNNTPServers(in *RuntimeSettings) []ServerRuntimeSettings

func RuntimeServersForCompatibility added in v0.7.1

func RuntimeServersForCompatibility(in *RuntimeSettings) []ServerRuntimeSettings

type SettingsAdmin added in v0.6.1

type SettingsAdmin interface {
	Get(ctx context.Context) (*RuntimeSettings, error)
	Capabilities(ctx context.Context) (*ControlPlaneCapabilities, error)
	Update(ctx context.Context, patch *RuntimeSettingsPatch) (*RuntimeSettings, error)
}

type SettingsCapability added in v0.7.1

type SettingsCapability struct {
	RuntimeConfigured bool `json:"runtime_configured"`
}

type SettingsStore added in v0.6.0

type SettingsStore interface {
	LoadEffectiveSettings(ctx context.Context, base *config.Config) (*config.Config, error)
	GetRuntimeSettings(ctx context.Context, base ...*config.Config) (*RuntimeSettings, error)
	UpdateSettings(ctx context.Context, next *RuntimeSettings) error
	WatchSettingsChanges(ctx context.Context) (<-chan struct{}, error)

	// store liveness + schema handshake.
	Ping(ctx context.Context) error
	SchemaVersion(ctx context.Context) (int, error)
	ExpectedSchemaVersion() int
	ValidateSchema(ctx context.Context) error
}

Runtime settings

type UsenetIndexCatalog added in v0.6.0

type UsenetIndexCatalog interface {
	GetCatalogReleaseByID(ctx context.Context, releaseID string) (*domain.Release, error)
}

minimal PG catalog boundary for Milestone 7 resolver routing.

type UsenetIndexStore added in v0.6.1

type UsenetIndexStore interface {
	UsenetIndexCatalog

	Ping(ctx context.Context) error
	ValidateSchema(ctx context.Context) error

	ListCatalogReleaseFiles(ctx context.Context, releaseID string) ([]pgindex.CatalogReleaseFile, error)
	ListCatalogReleaseFileArticles(ctx context.Context, releaseFileID int64) ([]pgindex.CatalogArticleRef, error)
	ListCatalogReleaseNewsgroups(ctx context.Context, releaseID string) ([]string, error)
	UpsertNZBCache(ctx context.Context, releaseID, generationStatus, hashSHA256, lastError string) error
	GetReleaseArchiveState(ctx context.Context, releaseID string) (*pgindex.ReleaseArchiveState, error)
	ClaimReleaseArchiveCandidates(ctx context.Context, limit int, policy pgindex.ReleaseReadyPolicy) ([]pgindex.ReleaseArchiveCandidate, error)
	MarkReleaseArchiveStored(ctx context.Context, in pgindex.ReleaseArchiveStoredRecord) error
	MarkReleaseArchiveFailed(ctx context.Context, releaseID, errText string) error
	ClaimReleasePurgeCandidates(ctx context.Context, limit int, policy pgindex.ReleaseReadyPolicy) ([]pgindex.ReleasePurgeCandidate, error)
	PurgeArchivedReleaseSources(ctx context.Context, releaseID string) (*pgindex.ReleasePurgeResult, error)
	ClaimIndexerStage(ctx context.Context, req pgindex.IndexerStageClaimRequest) (*pgindex.IndexerStageClaimResult, error)
	HeartbeatIndexerStageRun(ctx context.Context, runID int64, owner string, leaseDuration time.Duration) error
	CompleteIndexerStageRun(ctx context.Context, req pgindex.IndexerStageFinishRequest) error
	FailIndexerStageRun(ctx context.Context, req pgindex.IndexerStageFinishRequest) error
	PauseIndexerStage(ctx context.Context, stageName string) error
	ResumeIndexerStage(ctx context.Context, stageName string) error
	RepairIndexerStageRuntime(ctx context.Context) (*pgindex.IndexerStageRepairResult, error)
	ListIndexerStageStates(ctx context.Context) ([]pgindex.IndexerStageState, error)
	ListIndexerStageRuns(ctx context.Context, stageName string, limit int) ([]pgindex.IndexerStageRun, error)
	ListIndexerStageRunsFiltered(ctx context.Context, params pgindex.IndexerStageRunListParams) ([]pgindex.IndexerStageRun, error)
	GetIndexerStageRun(ctx context.Context, runID int64) (*pgindex.IndexerStageRun, error)
	GetIndexerOverview(ctx context.Context) (*pgindex.IndexerOverview, error)
	GetIndexerDashboardStats(ctx context.Context) (*pgindex.IndexerDashboardStats, error)
	RefreshIndexerDashboardStats(ctx context.Context) (*pgindex.IndexerDashboardStats, error)
	GetIndexerBackfillProgress(ctx context.Context) (*pgindex.IndexerBackfillProgress, error)
	GetIndexerCrosspostNewsgroupPopularity(ctx context.Context, limit int) ([]pgindex.IndexerCrosspostPopularityItem, error)
	ReplaceIndexerProviderGroupInventory(ctx context.Context, rows []pgindex.IndexerProviderGroupInventoryItem) error
	GetIndexerProviderGroupInventoryStats(ctx context.Context) (pgindex.IndexerProviderGroupInventoryStats, error)
	ListIndexerProviderGroupInventoryCandidates(ctx context.Context, query string, patternHints []string) ([]pgindex.IndexerProviderGroupInventoryItem, error)
	ListIndexerProviderGroupInventoryPage(ctx context.Context, query string, limit, offset int, sortKey, direction string) (pgindex.IndexerProviderGroupInventoryPage, error)
	GetIndexerStageThroughput(ctx context.Context) (*pgindex.IndexerStageThroughput, error)
	ListIndexerAdminAttention(ctx context.Context, params pgindex.IndexerAdminAttentionParams) ([]pgindex.IndexerAdminAttentionItem, int, error)
	ListIndexerArticleCohorts(ctx context.Context, params pgindex.IndexerArticleCohortParams) ([]pgindex.IndexerArticleCohortItem, int, error)
	ListIndexerReleases(ctx context.Context, params pgindex.AdminIndexerReleaseListParams) ([]pgindex.IndexerReleaseSummary, int, error)
	GetIndexerReleaseDetail(ctx context.Context, releaseID string) (*pgindex.IndexerReleaseDetail, error)
	ListPublicIndexerReleases(ctx context.Context, params pgindex.PublicIndexerReleaseListParams) ([]pgindex.PublicIndexerReleaseSummary, int, error)
	GetPublicIndexerReleaseDetailWithPolicy(ctx context.Context, releaseID string, policy pgindex.ReleaseReadyPolicy) (*pgindex.PublicIndexerReleaseDetail, error)
	GetPublicIndexerReleaseDetail(ctx context.Context, releaseID string) (*pgindex.PublicIndexerReleaseDetail, error)
	UpsertReleaseOverride(ctx context.Context, in pgindex.ReleaseOverrideRecord) error
	GetReleaseOverride(ctx context.Context, releaseID string) (*pgindex.ReleaseOverrideRecord, error)
	ResetReleaseInspectionState(ctx context.Context, releaseID string) error
	ResetReleaseEnrichmentState(ctx context.Context, releaseID string) error
	GetIndexerBinaryDetail(ctx context.Context, binaryID int64) (*pgindex.IndexerBinaryDetail, error)
	GetIndexerFileDetail(ctx context.Context, fileID int64) (*pgindex.IndexerFileDetail, error)

	EnsureProvider(ctx context.Context, providerKey, displayName string) (int64, error)
	EnsureNewsgroup(ctx context.Context, groupName string) (int64, error)
	StartScrapeRun(ctx context.Context, providerID int64) (int64, error)
	FinishScrapeRun(ctx context.Context, runID int64, status, errorText string) error
	GetLatestCheckpoint(ctx context.Context, providerID, newsgroupID int64) (int64, error)
	UpsertLatestCheckpoint(ctx context.Context, providerID, newsgroupID, lastArticleNumber int64) error
	GetBackfillCheckpoint(ctx context.Context, providerID, newsgroupID int64) (int64, error)
	UpsertBackfillCheckpoint(ctx context.Context, providerID, newsgroupID, backfillArticleNumber int64) error
	GetBackfillCheckpointState(ctx context.Context, providerID, newsgroupID int64) (*pgindex.BackfillCheckpointState, error)
	HasBackfillCutoffReachedForGroup(ctx context.Context, newsgroupID int64, untilDate time.Time) (bool, error)
	SetBackfillCheckpointState(ctx context.Context, providerID, newsgroupID int64, untilDate *time.Time, cutoffReached bool, stoppedReason string) error
	InsertArticleHeaders(ctx context.Context, providerID, newsgroupID int64, headers []pgindex.ArticleHeader) (int64, error)
	ObserveScrapeRange(ctx context.Context, providerID, newsgroupID int64, from, to int64, observations []pgindex.ScrapeRangeObservation) error
	GetYEncRecoveryAdmissionSnapshot(ctx context.Context) (*pgindex.YEncRecoveryAdmissionSnapshot, error)
	RefreshYEncRecoveryAdmissionSnapshot(ctx context.Context) (*pgindex.YEncRecoveryAdmissionSnapshot, error)
	ConfigureYEncRecoveryAdmission(ctx context.Context, cfg pgindex.YEncRecoveryAdmissionConfig) error
	UpsertIndexerGroupProfile(ctx context.Context, providerID, newsgroupID int64, tier, reason string) error
	RefreshIndexerGroupProfiles(ctx context.Context) (int64, error)
	UpsertDeferredArticleRange(ctx context.Context, in pgindex.DeferredArticleRangeRecord) error
	ExistingScrapeSourceDays(ctx context.Context, sourcePostedAt []time.Time) (map[string]bool, error)
	FindScrapedArticleRangeForDateWindow(ctx context.Context, providerID, newsgroupID int64, windowStart, windowEnd time.Time) (int64, int64, bool, error)
	EnsureScrapeTimeframeProgress(ctx context.Context, timeframeID string, providerID, newsgroupID int64, windowStart, windowEnd time.Time) (*pgindex.ScrapeTimeframeProgress, error)
	ResolveScrapeTimeframeProgress(ctx context.Context, timeframeID string, providerID, newsgroupID, articleLow, articleHigh int64, empty bool) error
	AdvanceScrapeTimeframeProgress(ctx context.Context, timeframeID string, providerID, newsgroupID, nextArticle int64, completed bool) error
	FailScrapeTimeframeProgress(ctx context.Context, timeframeID string, providerID, newsgroupID int64, cause string) error
	ClaimDeferredArticleRange(ctx context.Context, owner string, lease time.Duration) (*pgindex.DeferredArticleRangeClaim, error)
	CompleteDeferredArticleRange(ctx context.Context, id int64, owner string) error
	FailDeferredArticleRange(ctx context.Context, id int64, owner, cause string, maxAttempts int) error
	ListIndexerGroupProfiles(ctx context.Context, limit int) ([]pgindex.IndexerGroupProfileSummary, error)
	ListDeferredArticleRanges(ctx context.Context, state string, limit int) ([]pgindex.DeferredArticleRangeSummary, error)
	GetSourceBucketOutcomeReport(ctx context.Context, limit int) (*pgindex.SourceBucketOutcomeReport, error)
	RunArticleCohortScheduler(ctx context.Context, req pgindex.ArticleCohortSchedulerRequest) (*pgindex.ArticleCohortSchedulerResult, error)

	ListUnassembledArticleHeaders(ctx context.Context, limit int) ([]pgindex.AssemblyCandidate, error)
	ClaimUnassembledArticleHeaders(ctx context.Context, req pgindex.AssemblyClaimRequest) ([]pgindex.AssemblyCandidate, error)
	ClaimAssemblyQueueBatch(ctx context.Context, req pgindex.AssemblyClaimRequest) ([]pgindex.AssemblyCandidate, error)
	CleanupStaleAssemblyQueueRows(ctx context.Context, limit int) (int, error)
	RecordYEncRecoveryNotFound(ctx context.Context, articleHeaderID int64) error
	RecordYEncRecoveryNoop(ctx context.Context, articleHeaderID int64) error
	RecordYEncRecoveryTransientFailure(ctx context.Context, articleHeaderID int64) error
	UpsertBinary(ctx context.Context, in pgindex.BinaryRecord) (int64, error)
	UpsertBinaries(ctx context.Context, records []pgindex.BinaryRecord) ([]int64, error)
	UpsertBinaryPart(ctx context.Context, in pgindex.BinaryPartRecord) error
	UpsertBinaryParts(ctx context.Context, records []pgindex.BinaryPartRecord) error
	RefreshBinaryStats(ctx context.Context, binaryID int64) error
	RefreshBinaryStatsBatch(ctx context.Context, binaryIDs []int64) error
	CountQueuedReleaseFamilySummaries(ctx context.Context) (int, error)
	RefreshQueuedReleaseFamilySummaries(ctx context.Context, limit int) (int, error)

	ListReleaseCandidates(ctx context.Context, limit int, opts pgindex.ReleaseCandidateSelectionOptions) ([]pgindex.ReleaseCandidate, error)
	ListReleaseNZBGenerateCandidates(ctx context.Context, limit int, policy pgindex.ReleaseReadyPolicy) ([]pgindex.ReleaseNZBGenerateCandidate, error)
	ListExistingReleaseCandidates(ctx context.Context, limit, offset int) ([]pgindex.ReleaseCandidate, error)
	ListAutoReformReleaseCandidates(ctx context.Context, limit int, minReformAge time.Duration) ([]pgindex.ReleaseCandidate, error)
	ListExistingReleaseCandidatesForReleaseIDs(ctx context.Context, releaseIDs []string) ([]pgindex.ReleaseCandidate, error)
	ListBinariesForReleaseCandidate(ctx context.Context, providerID, newsgroupID int64, keyKind, releaseKey string) ([]pgindex.BinarySummary, error)
	ListBinaryPartArticles(ctx context.Context, binaryID int64) ([]pgindex.ReleaseFileArticleRecord, error)
	ListBinaryPartArticlesBatch(ctx context.Context, binaryIDs []int64) (map[int64][]pgindex.ReleaseFileArticleRecord, error)
	ListReleaseTitleCandidates(ctx context.Context, binaryIDs []int64) ([]pgindex.ReleaseTitleCandidate, error)
	UpsertRelease(ctx context.Context, in pgindex.ReleaseRecord) (string, error)
	PersistReleaseSnapshot(ctx context.Context, in pgindex.ReleaseRecord, files []pgindex.ReleaseFileRecord, newsgroupIDs []int64) (pgindex.ReleaseSnapshotResult, error)
	DeleteStaleReleasesForSourceKey(ctx context.Context, providerID int64, keyKind, releaseKey string, keepGroupNames []string) error
	DeleteAuxiliaryOnlySiblingReleases(ctx context.Context, providerID, newsgroupID int64, baseStem string, keepReleaseIDs []string) error
	ReplaceReleaseFiles(ctx context.Context, releaseID string, files []pgindex.ReleaseFileRecord) error
	ReplaceReleaseNewsgroups(ctx context.Context, releaseID string, newsgroupIDs []int64) error
	AckReleaseCandidate(ctx context.Context, providerID, newsgroupID int64, keyKind, familyKey string) error
	AckReleaseCandidates(ctx context.Context, candidates []pgindex.ReleaseCandidateAck) error
	PromoteBaseStemCandidatesForReleaseFamily(ctx context.Context, providerID, newsgroupID int64, releaseFamilyKey string) error
	ReopenArchivedReleaseForRegeneration(ctx context.Context, releaseID string) error
	RunIndexerMaintenance(ctx context.Context) (*pgindex.IndexerMaintenanceResult, error)
	DryRunReleaseSourcePurge(ctx context.Context, limit int, policy pgindex.ReleaseReadyPolicy) (*pgindex.MaintenanceTaskResult, error)
	RunReleaseSourcePurge(ctx context.Context, limit int, policy pgindex.ReleaseReadyPolicy) (*pgindex.MaintenanceTaskResult, error)
	DryRunSimpleMaintenanceTask(ctx context.Context, taskKey string, batchSize int) (*pgindex.MaintenanceTaskResult, error)
	RunSimpleMaintenanceTask(ctx context.Context, taskKey string, batchSize int) (*pgindex.MaintenanceTaskResult, error)
	DryRunRawStageRetentionTask(ctx context.Context, batchSize int, policy pgindex.RawStageRetentionPolicy) (*pgindex.MaintenanceTaskResult, error)
	RunRawStageRetentionTask(ctx context.Context, batchSize int, policy pgindex.RawStageRetentionPolicy) (*pgindex.MaintenanceTaskResult, error)
	DryRunPartitionRetentionTask(ctx context.Context, batchSize int) (*pgindex.MaintenanceTaskResult, error)
	RunPartitionRetentionTask(ctx context.Context, batchSize int) (*pgindex.MaintenanceTaskResult, error)
	DryRunPartitionDefaultRehomeTask(ctx context.Context, batchSize int) (*pgindex.MaintenanceTaskResult, error)
	RunPartitionDefaultRehomeTask(ctx context.Context, batchSize int) (*pgindex.MaintenanceTaskResult, error)
	ReconcileSourceBucketOutcomes(ctx context.Context, batchSize int, policy pgindex.SourceBucketOutcomePolicy) (*pgindex.MaintenanceTaskResult, error)
	ConfigurePartitionProvisioning(ddlLockTimeout time.Duration)
	ProvisionSourceWorkPartitions(ctx context.Context, daysBefore, daysAhead int) error
	ListIndexerBinaries(ctx context.Context, params pgindex.IndexerBinaryListParams) ([]pgindex.IndexerBinarySummary, int, error)
	PurgeArticleHeaderPayloads(ctx context.Context) (int64, error)
	BackfillIndexerCrosspostGroups(ctx context.Context, batchSize, maxBatches int) (*pgindex.IndexerCrosspostBackfillResult, error)
	MaterializeArticleHeaderPosters(ctx context.Context, limit int) (*pgindex.IndexerPosterMaterializationResult, error)
	RefreshCrosspostPopularity(ctx context.Context, limit int) (*pgindex.IndexerCrosspostPopularityRefreshResult, error)
	RunIndexerStorageReclaim(ctx context.Context, options pgindex.IndexerStorageReclaimOptions) (*pgindex.IndexerStorageReclaimResult, error)
	CheckCriticalIndexerIntegrity(ctx context.Context, ensureExtension bool) (*pgindex.IndexerIntegrityReport, error)
	ReindexCriticalIndexerIndexes(ctx context.Context) (*pgindex.IndexerIntegrityRepairResult, error)
	DatabaseStorageStatus(ctx context.Context) (*pgindex.DatabaseStorageStatus, error)
	ListBinaryInspectionCandidates(ctx context.Context, stageName string, limit int) ([]pgindex.BinaryInspectionCandidate, error)
	ListBinaryInspectionCandidatesWithOptions(ctx context.Context, stageName string, limit int, opts pgindex.BinaryInspectionCandidateOptions) ([]pgindex.BinaryInspectionCandidate, error)
	ClaimBinaryInspectionCandidates(ctx context.Context, req pgindex.BinaryInspectionClaimRequest) ([]pgindex.BinaryInspectionCandidate, error)
	StartBinaryInspection(ctx context.Context, stageName string, binaryID int64, releaseID string, sourceUpdatedAt *time.Time) error
	CompleteBinaryInspection(ctx context.Context, in pgindex.BinaryInspectionRecord) error
	FailBinaryInspection(ctx context.Context, in pgindex.BinaryInspectionRecord) error
	ReplaceBinaryInspectionArtifacts(ctx context.Context, stageName string, binaryID int64, rows []pgindex.BinaryInspectionArtifactRecord) error
	ReplaceBinaryArchiveEntries(ctx context.Context, binaryID int64, rows []pgindex.BinaryArchiveEntryRecord) error
	ReplaceBinaryMediaStreams(ctx context.Context, binaryID int64, rows []pgindex.BinaryMediaStreamRecord) error
	ReplaceBinaryTextEvidence(ctx context.Context, stageName string, binaryID int64, rows []pgindex.BinaryTextEvidenceRecord) error
	ReplaceBinaryPAR2Sets(ctx context.Context, binaryID int64, rows []pgindex.BinaryPAR2SetRecord) error
	ReplaceBinaryPAR2Targets(ctx context.Context, binaryID int64, rows []pgindex.BinaryPAR2TargetRecord) error
	ApplyBinaryPAR2TargetCoverage(ctx context.Context, binaryID int64, rows []pgindex.BinaryPAR2TargetRecord) (*pgindex.BinaryPAR2TargetCoverageResult, error)
	ApplyPAR2InspectionBatch(ctx context.Context, rows []pgindex.PAR2InspectionBatchRecord) (*pgindex.PAR2InspectionBatchResult, error)
	ApplyBinaryRecovery(ctx context.Context, in pgindex.BinaryRecoveryRecord) error
	ListYEncRecoveryCandidates(ctx context.Context, limit int) ([]pgindex.YEncRecoveryCandidate, error)
	ApplyYEncHeaderRecovery(ctx context.Context, in pgindex.YEncHeaderRecoveryRecord) (*pgindex.YEncHeaderRecoveryResult, error)
	UpsertReleasePasswordCandidate(ctx context.Context, in pgindex.ReleasePasswordCandidateRecord) (int64, error)
	ListPasswordVerificationCandidates(ctx context.Context, limit int) ([]pgindex.PasswordVerificationCandidate, error)
	UpdateReleasePasswordCandidateStatus(ctx context.Context, candidateID int64, status string, verifiedAt *time.Time, lastError string) error
	ApplyReleaseInspectionUpdate(ctx context.Context, in pgindex.ReleaseInspectionUpdate) error
	SetReleaseArchivePreview(ctx context.Context, releaseID, objectKey, contentType, sourceKind string) error
	ListReleaseEnrichmentCandidates(ctx context.Context, stageName string, limit int) ([]pgindex.ReleaseEnrichmentCandidate, error)
	UpsertPredbEntries(ctx context.Context, rows []pgindex.PredbEntryRecord) error
	GetPredbBackfillWindow(ctx context.Context) (*pgindex.PredbBackfillWindow, error)
	GetPredbEntryWindow(ctx context.Context) (*pgindex.PredbBackfillWindow, error)
	GetPredbBackfillCheckpoint(ctx context.Context, provider string) (*pgindex.PredbBackfillCheckpoint, error)
	UpsertPredbBackfillCheckpoint(ctx context.Context, in pgindex.PredbBackfillCheckpoint) error
	ListPredbEntriesForWindow(ctx context.Context, from, to *time.Time, categoryHint string, limit int) ([]pgindex.PredbEntrySummary, error)
	ReplaceReleasePredbMatches(ctx context.Context, releaseID string, rows []pgindex.ReleasePredbMatchRecord) error
	ReplaceReleaseTMDBMatches(ctx context.Context, releaseID string, rows []pgindex.ReleaseTMDBMatchRecord) error
	ReplaceReleaseTVDBMatches(ctx context.Context, releaseID string, rows []pgindex.ReleaseTVDBMatchRecord) error
	ApplyReleasePredbUpdate(ctx context.Context, in pgindex.ReleasePredbUpdate) error
	ApplyReleaseManualIdentity(ctx context.Context, in pgindex.ReleaseManualIdentityUpdate) error
	ApplyReleaseEnrichmentUpdate(ctx context.Context, in pgindex.ReleaseEnrichmentUpdate) error
}

current PG-backed store surface used by resolver, indexing runtime, health checks, and smoke tests. This keeps Context from depending on the concrete *pgindex.Store type directly.

type UsenetIndexerService added in v0.6.0

type UsenetIndexerService interface {
	ScrapeOnce(ctx context.Context) error
	ScrapeLatestOnce(ctx context.Context) error
	ScrapeBackfillOnce(ctx context.Context) error
	AssembleOnce(ctx context.Context) error
	RecoverYEncOnce(ctx context.Context) error
	ReleaseSummaryRefreshOnce(ctx context.Context) error
	ReleaseOnce(ctx context.Context) error
	ReleaseGenerateNZBOnce(ctx context.Context) error
	ReleaseArchiveNZBOnce(ctx context.Context) error
	ReleasePurgeArchivedSourcesOnce(ctx context.Context) error
	ReformReleasesOnce(ctx context.Context) error
	ReformSelectedReleasesOnce(ctx context.Context, releaseIDs []string) error
	InspectOnce(ctx context.Context) error
	InspectDiscoveryOnce(ctx context.Context) error
	InspectPAR2Once(ctx context.Context) error
	InspectNFOOnce(ctx context.Context) error
	InspectArchiveOnce(ctx context.Context) error
	InspectPasswordOnce(ctx context.Context) error
	InspectMediaOnce(ctx context.Context) error
	EnrichPredbOnce(ctx context.Context) error
	EnrichPredbSceneNameRecoveryOnce(ctx context.Context) error
	EnrichPredbMetadataFallbackOnce(ctx context.Context) error
	EnrichPredbSyncFeedOnce(ctx context.Context) error
	EnrichPredbSyncBackfillOnce(ctx context.Context) error
	EnrichTMDBOnce(ctx context.Context) error
	RunStageOnce(ctx context.Context, stageName string) error
	RunPipelineOnce(ctx context.Context) error
	Start(ctx context.Context, interval time.Duration) error
	NNTPStats(ctx context.Context) (*NNTPRuntimeStats, error)
}

Jump to

Keyboard shortcuts

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