Documentation
¶
Index ¶
- type Aggregator
- func (a *Aggregator) ApplyMinimumPicks(allItems []scoring.ContentScore, jobMinimums []JobMinimum, limit int) []scoring.ContentScore
- func (a *Aggregator) CalculateResetTime(period string) time.Time
- func (a *Aggregator) CheckGlobalLimit(mediaType string) (bool, error)
- func (a *Aggregator) IncrementGlobalCount(mediaType string) error
- func (a *Aggregator) RankAndLimit(items []scoring.ContentScore, mediaType string) []scoring.ContentScore
- func (a *Aggregator) ShouldUseGlobalLimits(mediaType string) bool
- type JobMinimum
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 ¶
JobMinimum represents a job's minimum pick requirement