pulse

package
v0.0.0-...-d771ed5 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT Imports: 17 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Integration

type Integration struct {
	Client *sdk.Client
	// contains filtered or unexported fields
}

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

func (i *Integration) DiscoverDownloadClients(ctx context.Context) ([]sdk.Service, error)

DiscoverDownloadClients returns download clients registered in Pulse.

func (*Integration) DiscoverIndexers

func (i *Integration) DiscoverIndexers(ctx context.Context) ([]sdk.Indexer, error)

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

func (i *Integration) SyncIndexers(ctx context.Context, indexerSvc *indexer.Service) error

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

func (i *Integration) SyncQualityProfiles(ctx context.Context, qualitySvc *quality.Service) error

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.

Jump to

Keyboard shortcuts

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