Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrIncomplete = errors.New("cancelled before a solution could be found")
Functions ¶
This section is empty.
Types ¶
type AppliedConstraint ¶
type AppliedConstraint struct { Installable Installable Constraint Constraint }
AppliedConstraint values compose a single Constraint with the Installable it applies to.
func (AppliedConstraint) String ¶
func (a AppliedConstraint) String() string
String implements fmt.Stringer and returns a human-readable message representing the receiver.
type Constraint ¶
type Constraint interface { String(subject Identifier) string // contains filtered or unexported methods }
Constraint implementations limit the circumstances under which a particular Installable can appear in a solution.
func AtMost ¶
func AtMost(n int, ids ...Identifier) Constraint
AtMost returns a Constraint that forbids solutions that contain more than n of the Installables identified by the given Identifiers.
func Conflict ¶
func Conflict(id Identifier) Constraint
Conflict returns a Constraint that will permit solutions containing either the constrained Installable, the Installable identified by the given Identifier, or neither, but not both.
func Dependency ¶
func Dependency(ids ...Identifier) Constraint
Dependency returns a Constraint that will only permit solutions containing a given Installable on the condition that at least one of the Installables identified by the given Identifiers also appears in the solution. Identifiers appearing earlier in the argument list have higher preference than those appearing later.
func Mandatory ¶
func Mandatory() Constraint
Mandatory returns a Constraint that will permit only solutions that contain a particular Installable.
func Prohibited ¶
func Prohibited() Constraint
Prohibited returns a Constraint that will reject any solution that contains a particular Installable. Callers may also decide to omit an Installable from input to Solve rather than apply such a Constraint.
type ConstraintProvider ¶ added in v0.20.0
type ConstraintProvider interface { // Constraints returns a set of solver constraints for a cache entry. Constraints(e *cache.Entry) ([]Constraint, error) }
ConstraintProvider knows how to provide solver constraints for a given cache entry. For instance, it could be used to surface additional constraints against an entry given some properties it may expose. E.g. olm.maxOpenShiftVersion could be checked against the cluster version and prohibit any entry that doesn't meet the requirement
type ConstraintProviderFunc ¶ added in v0.20.0
type ConstraintProviderFunc func(e *cache.Entry) ([]Constraint, error)
ConstraintProviderFunc is a simple implementation of ConstraintProvider
func (ConstraintProviderFunc) Constraints ¶ added in v0.20.0
func (c ConstraintProviderFunc) Constraints(e *cache.Entry) ([]Constraint, error)
type DefaultTracer ¶
type DefaultTracer struct{}
func (DefaultTracer) Trace ¶
func (DefaultTracer) Trace(_ SearchPosition)
type DuplicateIdentifier ¶
type DuplicateIdentifier Identifier
func (DuplicateIdentifier) Error ¶
func (e DuplicateIdentifier) Error() string
type Identifier ¶
type Identifier string
Identifier values uniquely identify particular Installables within the input to a single call to Solve.
func IdentifierFromString ¶ added in v0.18.0
func IdentifierFromString(s string) Identifier
IdentifierFromString returns an Identifier based on a provided string.
func (Identifier) String ¶
func (id Identifier) String() string
type Installable ¶
type Installable interface { // Identifier returns the Identifier that uniquely identifies // this Installable among all other Installables in a given // problem. Identifier() Identifier // Constraints returns the set of constraints that apply to // this Installable. Constraints() []Constraint }
Installable values are the basic unit of problems and solutions understood by this package.
type LoggingTracer ¶
func (LoggingTracer) Trace ¶
func (t LoggingTracer) Trace(p SearchPosition)
type NotSatisfiable ¶
type NotSatisfiable []AppliedConstraint
NotSatisfiable is an error composed of a minimal set of applied constraints that is sufficient to make a solution impossible.
func (NotSatisfiable) Error ¶
func (e NotSatisfiable) Error() string
type Option ¶
type Option func(s *solver) error
func WithInput ¶
func WithInput(input []Installable) Option
func WithTracer ¶
type SearchPosition ¶
type SearchPosition interface { Installables() []Installable Conflicts() []AppliedConstraint }
type Tracer ¶
type Tracer interface {
Trace(p SearchPosition)
}