reconcile

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CatalogStore

type CatalogStore interface {
	ListActiveItemKeysByChannelKey(ctx context.Context, channelKey string) ([]string, error)
	ListActiveItemKeysByCatalogFilter(ctx context.Context, groupNames []string, searchQuery string, searchRegex bool) ([]string, error)
}

CatalogStore provides active source lookups by channel key.

type ChannelsService

type ChannelsService interface {
	List(ctx context.Context) ([]channels.Channel, error)
	ListSources(ctx context.Context, channelID int64, enabledOnly bool) ([]channels.Source, error)
	AddSource(ctx context.Context, channelID int64, itemKey string, allowCrossChannel bool) (channels.Source, error)
	// SyncDynamicSources must treat matchedItemKeys as read-only input.
	SyncDynamicSources(ctx context.Context, channelID int64, matchedItemKeys []string) (channels.DynamicSourceSyncResult, error)
	SyncDynamicChannelBlocks(ctx context.Context) (channels.DynamicChannelSyncResult, error)
	RefreshDynamicGeneratedGuideNames(ctx context.Context) (int, error)
}

ChannelsService provides channel and source operations needed for reconciliation.

type Result

type Result struct {
	ChannelsTotal            int `json:"channels_total"`
	ChannelsProcessed        int `json:"channels_processed"`
	ChannelsSkipped          int `json:"channels_skipped"`
	SourcesAdded             int `json:"sources_added"`
	SourcesAlreadySeen       int `json:"sources_existing"`
	DynamicBlocksProcessed   int `json:"dynamic_blocks_processed"`
	DynamicBlocksEnabled     int `json:"dynamic_blocks_enabled"`
	DynamicChannelsAdded     int `json:"dynamic_channels_added"`
	DynamicChannelsUpdated   int `json:"dynamic_channels_updated"`
	DynamicChannelsRetained  int `json:"dynamic_channels_retained"`
	DynamicChannelsRemoved   int `json:"dynamic_channels_removed"`
	DynamicChannelsTruncated int `json:"dynamic_channels_truncated"`
	DynamicChannelsProcessed int `json:"dynamic_channels_processed"`
	DynamicSourcesAdded      int `json:"dynamic_sources_added"`
	DynamicSourcesRemoved    int `json:"dynamic_sources_removed"`
	DynamicGuideNamesUpdated int `json:"dynamic_guide_names_updated"`
}

Result summarizes one reconciliation run.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service reconciles published channels against active catalog sources.

func New

func New(catalog CatalogStore, channelsSvc ChannelsService) (*Service, error)

func (*Service) CountChannels

func (s *Service) CountChannels(ctx context.Context) (int, error)

CountChannels returns the number of reconcilable channels.

func (*Service) Reconcile

func (s *Service) Reconcile(ctx context.Context, onProgress func(cur, max int) error) (Result, error)

Reconcile updates channel sources by mode:

  • static channels append newly discovered channel_key matches
  • dynamic channels synchronize association_type=dynamic_query to catalog filter output

func (*Service) SetDynamicRuleMatchLimit

func (s *Service) SetDynamicRuleMatchLimit(limit int)

SetDynamicRuleMatchLimit sets the maximum allowed matches for one dynamic rule sync pass. Values <= 0 disable the guard.

func (*Service) SetDynamicRulePagedMode

func (s *Service) SetDynamicRulePagedMode(enabled bool)

SetDynamicRulePagedMode toggles paged catalog-filter sync for dynamic rules. When disabled, reconcile uses the legacy in-memory slice path.

func (*Service) SetLogger

func (s *Service) SetLogger(logger *slog.Logger)

Jump to

Keyboard shortcuts

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