github.com/operator-framework/operator-lifecycle-manager@v0.30.0/pkg/controller/registry/resolver/solver/variable.go (about) 1 package solver 2 3 // Identifier values uniquely identify particular Variables within 4 // the input to a single call to Solve. 5 type Identifier string 6 7 func (id Identifier) String() string { 8 return string(id) 9 } 10 11 // IdentifierFromString returns an Identifier based on a provided 12 // string. 13 func IdentifierFromString(s string) Identifier { 14 return Identifier(s) 15 } 16 17 // Variable values are the basic unit of problems and solutions 18 // understood by this package. 19 type Variable interface { 20 // Identifier returns the Identifier that uniquely identifies 21 // this Variable among all other Variables in a given 22 // problem. 23 Identifier() Identifier 24 // Constraints returns the set of constraints that apply to 25 // this Variable. 26 Constraints() []Constraint 27 } 28 29 // zeroVariable is returned by VariableOf in error cases. 30 type zeroVariable struct{} 31 32 var _ Variable = zeroVariable{} 33 34 func (zeroVariable) Identifier() Identifier { 35 return "" 36 } 37 38 func (zeroVariable) Constraints() []Constraint { 39 return nil 40 }