Documentation
¶
Overview ¶
Package pulse integrates Prism with the Pulse control plane. When configured, Prism registers itself on startup, sends heartbeats, and can discover ecosystem services and shared configuration.
Index ¶
- type Integration
- func (i *Integration) Close()
- func (i *Integration) DiscoverDownloadClients(ctx context.Context) ([]sdk.Service, error)
- func (i *Integration) DiscoverIndexers(ctx context.Context) ([]sdk.Indexer, error)
- func (i *Integration) StartSyncLoop(ctx context.Context, indexerSvc *indexer.Service, dlSvc *downloader.Service, ...)
- func (i *Integration) SyncDownloadClients(ctx context.Context, dlSvc *downloader.Service) error
- func (i *Integration) SyncHandler(indexerSvc *indexer.Service, dlSvc *downloader.Service) http.HandlerFunc
- func (i *Integration) SyncIndexers(ctx context.Context, indexerSvc *indexer.Service) error
- func (i *Integration) SyncQualityProfiles(ctx context.Context, qualitySvc *quality.Service) error
- func (i *Integration) SyncSharedSettings(ctx context.Context, mmSvc *mediamanagement.Service) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Integration ¶
Integration wraps the Pulse SDK client and provides Prism-specific convenience methods.
func New ¶
func New(cfg config.PulseConfig, serverHost string, serverPort int, serviceAPIKey string, logger *slog.Logger) (*Integration, error)
New creates and registers with Pulse. Returns nil (not an error) if Pulse is not configured — this makes integration optional.
If only the URL is set (no API key), it will attempt to auto-discover the key from Pulse's config file at ~/.config/pulse/config.yaml.
func (*Integration) Close ¶
func (i *Integration) Close()
Close stops heartbeats. Does not deregister — the service stays registered so Pulse can mark it as offline via health checks.
func (*Integration) DiscoverDownloadClients ¶
DiscoverDownloadClients returns download clients registered in Pulse.
func (*Integration) DiscoverIndexers ¶
DiscoverIndexers returns indexers assigned to this service in Pulse.
func (*Integration) StartSyncLoop ¶
func (i *Integration) StartSyncLoop(ctx context.Context, indexerSvc *indexer.Service, dlSvc *downloader.Service, qualitySvc *quality.Service, mmSvc *mediamanagement.Service, interval time.Duration)
StartSyncLoop runs indexer, download client, quality profile, and shared settings sync on a periodic interval. It runs an immediate sync on start, then repeats every interval.
func (*Integration) SyncDownloadClients ¶
func (i *Integration) SyncDownloadClients(ctx context.Context, dlSvc *downloader.Service) error
SyncDownloadClients pulls download clients from Pulse and syncs them into Prism's local database. Same pattern as indexer sync.
func (*Integration) SyncHandler ¶
func (i *Integration) SyncHandler(indexerSvc *indexer.Service, dlSvc *downloader.Service) http.HandlerFunc
SyncHandler returns an http.HandlerFunc that triggers an immediate sync of indexers and download clients from the Pulse control plane. Called by Pulse when configs change.
POST /api/v1/hooks/pulse/sync
func (*Integration) SyncIndexers ¶
SyncIndexers pulls indexers assigned to this service from Pulse and ensures they exist in Prism's local indexer database. New indexers are created; existing ones (matched by name) are left as-is.
func (*Integration) SyncQualityProfiles ¶
SyncQualityProfiles reconciles Pulse-managed quality profiles with the local database. Same pattern as Prism's implementation:
- match by ID (Pulse UUID is canonical)
- create missing, update changed, delete absent
- never touch managed_by_pulse=false (local shadows)
func (*Integration) SyncSharedSettings ¶
func (i *Integration) SyncSharedSettings(ctx context.Context, mmSvc *mediamanagement.Service) error
SyncSharedSettings pulls the shared media handling settings from Pulse and overlays them on Pilot's local media_management row. Only the 4 shared fields are touched — episode naming templates and other per-service settings are untouched.