Documentation
¶
Overview ¶
Package app wires Ether's components into one running server: the Plex front end and the owner UI on one port, and the background services (catalogue sync, plex.tv registration, prefetch, LAN discovery) behind it.
Index ¶
Constants ¶
const PerfTagHeader = "X-Ether-Perf-Tag"
PerfTagHeader is copied into the trace record of the request carrying it.
const PerfTraceDepthEnv = "ETHER_PERF_TRACE_DEPTH"
PerfTraceDepthEnv sets how many callers each traced statement's site records (default 1).
const PerfTraceEnv = "ETHER_PERF_TRACE"
PerfTraceEnv names a file that receives one JSON line per HTTP request (surface, path, status, duration and its database work). cmd/etherperf sets it; production leaves it unset.
const PprofAddrEnv = "ETHER_PPROF_ADDR"
PprofAddrEnv enables Go's profiler on a loopback address, for profiling a hot path on real data (cmd/etherperf sets it). Non-loopback addresses are refused: profiles expose memory contents.
Variables ¶
var ErrUnresponsive = errors.New("app: server unresponsive to local health probes")
ErrUnresponsive is returned by App.Run when the server stopped answering its own local health probe. The process then exits non-zero so the service manager restarts it.
Functions ¶
func Serve ¶ added in v0.2.4
Serve owns the complete application lifetime. It binds the port as soon as the data directory is locked, so the console can show a starting server's progress (startup.Gate), and keeps it across App instances. A UI cluster transition first stops HTTP and every background writer and closes SQLite, then migrates and starts a fresh App. A start that fails after the port is bound does not exit (a service manager would only restart it into the same failure): the status page explains the failure, offers a restore on a standalone server, and the start is retried with backoff. It works in the foreground and under every OS supervisor.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is a running Ether server.
func (*App) Close ¶
func (a *App) Close()
Close releases every component in reverse order of construction.
type Options ¶
type Options struct {
// NotificationExecutable enables the independent crash watcher for executable runs.
NotificationExecutable string
DataDir string
Version string
// Logger receives everything; the admin log ring is teed onto it.
Logger *slog.Logger
// Spike forces spike mode (local files, no Usenet) on top of config.
Spike bool
// SpikeFiles are extra local files for spike mode.
SpikeFiles []string
// DBRetryMin / DBRetryMax bound the backoff while a clustered node
// waits at startup for an unreachable PostgreSQL server (1s / 30s).
DBRetryMin, DBRetryMax time.Duration
// FixtureMedia, when set, is the resolver indexer, release health checker,
// and playback engine. Production leaves it nil.
FixtureMedia interface {
core.Indexer
core.HealthChecker
core.Engine
}
// FixtureTranscoder, when set, replaces the ffmpeg manager so every
// protocol shares one transcode budget without an encoder binary.
FixtureTranscoder core.Transcoder
// CatalogNow, when set, is the catalog clock from construction. Tests
// pin it so a minute snapshot cannot expire while a background browse runs.
CatalogNow func() time.Time
// contains filtered or unexported fields
}
Options configure a run.
type PerfTraceRecord ¶ added in v0.3.0
type PerfTraceRecord struct {
// Tag echoes the X-Ether-Perf-Tag request header, so the harness can
// join a trace line to the step that sent it.
Tag string `json:"tag,omitempty"`
Surface string `json:"surface"`
Method string `json:"method"`
Path string `json:"path"`
Status int `json:"status"`
Bytes int `json:"bytes"`
Start time.Time `json:"start"`
Duration time.Duration `json:"duration"`
Queries int64 `json:"queries"`
Writes int64 `json:"writes"`
Rows int64 `json:"rows"`
DBTime time.Duration `json:"dbTime"`
LockWait time.Duration `json:"lockWait"`
Statements []store.StatementStat `json:"statements,omitempty"`
}
PerfTraceRecord is one line of the ETHER_PERF_TRACE file.
Source Files
¶
- admin.go
- adoption.go
- app.go
- availability.go
- availability_catalog.go
- backup_alerts.go
- budgets.go
- build_catalogue.go
- build_identity.go
- build_integrations.go
- build_personalization.go
- build_playback.go
- build_prefetch.go
- build_sources.go
- cache.go
- calendar.go
- cluster.go
- cluster_manage.go
- cluster_settings.go
- cluster_setup.go
- collections.go
- compat_catalog.go
- compatibility.go
- credentials.go
- dbhealth.go
- diagnostics.go
- direct_only.go
- discovery.go
- egress.go
- extensions.go
- extras.go
- favorite_episode_alerts.go
- favorite_shows.go
- frontdoor.go
- frontend_admin.go
- frontend_artwork.go
- frontend_capabilities.go
- frontend_clients.go
- frontend_detail.go
- frontend_discovery.go
- frontend_dlna_guest.go
- frontend_dlna_identity.go
- frontend_editions.go
- frontend_experience.go
- frontend_experience_policy.go
- frontend_experience_rows.go
- frontend_favorites.go
- frontend_favorites_policy.go
- frontend_identity.go
- frontend_image_maintenance.go
- frontend_images.go
- frontend_last_played.go
- frontend_listeners.go
- frontend_livetv.go
- frontend_membership.go
- frontend_notinterested.go
- frontend_people.go
- frontend_people_policy.go
- frontend_playability.go
- frontend_playback_extras.go
- frontend_portal.go
- frontend_row_views.go
- frontend_runtime.go
- frontend_track_preferences.go
- frontend_version.go
- frontend_version_observed.go
- frontend_viewer_capabilities.go
- frontend_viewer_policy.go
- frontend_virtual_paths.go
- home_rows.go
- indexersites.go
- insights.go
- instance_lock.go
- instance_lock_unix.go
- langfeat.go
- lanonly.go
- library_page_exclusions.go
- listener.go
- livetv.go
- local_editions_default.go
- maintenance.go
- nodefacts.go
- outbound.go
- owner_playback.go
- ownerrecovery.go
- parity_runtime_default.go
- parity_source_default.go
- perf_observe.go
- personal_home_store.go
- playback_policy.go
- plex.go
- plexwatch.go
- pprof.go
- preupgrade.go
- prowlarr_sync.go
- recovery.go
- restart.go
- retired_schema.go
- rolling.go
- save_validated.go
- schedules.go
- scorecard_profile_diagnostic_default.go
- scorecard_sessions_default.go
- scorecard_surface_default.go
- scorecard_variants_default.go
- session_broker.go
- session_live.go
- session_tracks.go
- simkl.go
- startup.go
- streams.go
- subtitle_languages.go
- subtitle_sync.go
- support.go
- updates.go
- watchdog.go