releasepolicy

package
v0.2.49 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package releasepolicy evaluates the same bounded, declarative rules for playback, release search and unsaved previews. No client or UI dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Better

func Better(a, b Result) bool

Better gives explicit fallback tiers precedence, then ordered preferences. Equal policy results leave TRaSH, health and source routing order untouched.

func Conflict

func Conflict(rules []core.ReleaseRule) string

Conflict describes required rules that cannot be true of one release. Empty means no such conflict. Disabled rules, exceptions and fallbacks are left alone: those can still be satisfied.

func Equivalent

func Equivalent(a, b Result) bool

Equivalent reports the same fallback tier and the same ordered preference vector. Health racing may overtake only an equivalent candidate; a fallback must not pass a still-valid primary.

func UsesOriginalAudio

func UsesOriginalAudio(rules []core.ReleaseRule) bool

UsesOriginalAudio reports whether evaluation of these rules needs the catalogue original language. Disabled rules do not.

Types

type Context

type Context struct {
	OriginalLanguage string
}

Context is evidence that belongs to the title, not the release. OriginalLanguage is the catalogue title's original language (Title.Language) when the caller has that title. An empty value means the comparison is unavailable. It is never a guessed language, and it is not part of the profile selection hash or the search cache key.

type Explanation

type Explanation struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Action  string `json:"action"`
	State   State  `json:"state"`
	Outcome string `json:"outcome"` // pass, exclude, prefer, fallback, skip, unknown
}

type Policy

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

func Compile

func Compile(rules []core.ReleaseRule) (*Policy, error)

func (*Policy) Evaluate

func (p *Policy) Evaluate(rel core.Release, ctx Context) Result

type Result

type Result struct {
	Rejected     bool          `json:"rejected"`
	Unknown      bool          `json:"unknown"`
	Fallback     int           `json:"fallback"`
	Preferences  []int         `json:"preferences"`
	Explanations []Explanation `json:"explanations"`
}

type State

type State string
const (
	Match   State = "match"
	Miss    State = "miss"
	Unknown State = "unknown"
)

Jump to

Keyboard shortcuts

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