aggregator

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregator

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

Aggregator handles content aggregation, scoring, and limit tracking

func New

func New(cfg *config.Config, db *database.Database) *Aggregator

New creates a new Aggregator instance

func (*Aggregator) ApplyMinimumPicks

func (a *Aggregator) ApplyMinimumPicks(allItems []scoring.ContentScore, jobMinimums []JobMinimum, limit int) []scoring.ContentScore

ApplyMinimumPicks ensures each job gets at least its configured minimum picks Takes ALL ranked items (not just top N) and applies minimum picks logic

func (*Aggregator) CalculateResetTime

func (a *Aggregator) CalculateResetTime(period string) time.Time

CalculateResetTime calculates the next reset time based on the period

func (*Aggregator) CheckGlobalLimit

func (a *Aggregator) CheckGlobalLimit(mediaType string) (bool, error)

CheckGlobalLimit checks if adding an item would exceed the global limit for the period Returns true if the item can be added, false if limit is reached

func (*Aggregator) IncrementGlobalCount

func (a *Aggregator) IncrementGlobalCount(mediaType string) error

IncrementGlobalCount increments the global count for the period and media type

func (*Aggregator) RankAndLimit

func (a *Aggregator) RankAndLimit(items []scoring.ContentScore, mediaType string) []scoring.ContentScore

RankAndLimit sorts items by score and applies global limits if configured Returns the top items within the limit (or all items if no limit)

func (*Aggregator) ShouldUseGlobalLimits

func (a *Aggregator) ShouldUseGlobalLimits(mediaType string) bool

ShouldUseGlobalLimits returns true if global limits should be enforced for the given media type

type JobMinimum

type JobMinimum struct {
	JobName string
	Minimum int
}

JobMinimum represents a job's minimum pick requirement

Jump to

Keyboard shortcuts

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