@@ -14,33 +14,33 @@ import (
1414 "github.com/operator-framework/operator-controller/internal/resolution/variable_sources/util/sort"
1515)
1616
17- type RequiredPackageVariable struct {
17+ type Variable struct {
1818 * input.SimpleVariable
1919 bundleEntities []* olmentity.BundleEntity
2020}
2121
22- func (r * RequiredPackageVariable ) BundleEntities () []* olmentity.BundleEntity {
22+ func (r * Variable ) BundleEntities () []* olmentity.BundleEntity {
2323 return r .bundleEntities
2424}
2525
26- func NewRequiredPackageVariable (packageName string , bundleEntities []* olmentity.BundleEntity ) * RequiredPackageVariable {
26+ func NewRequiredPackageVariable (packageName string , bundleEntities []* olmentity.BundleEntity ) * Variable {
2727 id := deppy .IdentifierFromString (fmt .Sprintf ("required package %s" , packageName ))
2828 entityIDs := make ([]deppy.Identifier , 0 , len (bundleEntities ))
2929 for _ , bundle := range bundleEntities {
3030 entityIDs = append (entityIDs , bundle .ID )
3131 }
32- return & RequiredPackageVariable {
32+ return & Variable {
3333 SimpleVariable : input .NewSimpleVariable (id , constraint .Mandatory (), constraint .Dependency (entityIDs ... )),
3434 bundleEntities : bundleEntities ,
3535 }
3636}
3737
38- var _ input.VariableSource = & RequiredPackageVariableSource {}
38+ var _ input.VariableSource = & VariableSource {}
3939
40- type RequiredPackageOption func (* RequiredPackageVariableSource ) error
40+ type Option func (* VariableSource ) error
4141
42- func InVersionRange (versionRange string ) RequiredPackageOption {
43- return func (r * RequiredPackageVariableSource ) error {
42+ func InVersionRange (versionRange string ) Option {
43+ return func (r * VariableSource ) error {
4444 if versionRange != "" {
4545 vr , err := semver .ParseRange (versionRange )
4646 if err == nil {
@@ -55,8 +55,8 @@ func InVersionRange(versionRange string) RequiredPackageOption {
5555 }
5656}
5757
58- func InChannel (channelName string ) RequiredPackageOption {
59- return func (r * RequiredPackageVariableSource ) error {
58+ func InChannel (channelName string ) Option {
59+ return func (r * VariableSource ) error {
6060 if channelName != "" {
6161 r .channelName = channelName
6262 r .predicates = append (r .predicates , predicates .InChannel (channelName ))
@@ -65,18 +65,18 @@ func InChannel(channelName string) RequiredPackageOption {
6565 }
6666}
6767
68- type RequiredPackageVariableSource struct {
68+ type VariableSource struct {
6969 packageName string
7070 versionRange string
7171 channelName string
7272 predicates []input.Predicate
7373}
7474
75- func NewRequiredPackage (packageName string , options ... RequiredPackageOption ) (* RequiredPackageVariableSource , error ) {
75+ func NewRequiredPackage (packageName string , options ... Option ) (* VariableSource , error ) {
7676 if packageName == "" {
7777 return nil , fmt .Errorf ("package name must not be empty" )
7878 }
79- r := & RequiredPackageVariableSource {
79+ r := & VariableSource {
8080 packageName : packageName ,
8181 predicates : []input.Predicate {predicates .WithPackageName (packageName )},
8282 }
@@ -88,7 +88,7 @@ func NewRequiredPackage(packageName string, options ...RequiredPackageOption) (*
8888 return r , nil
8989}
9090
91- func (r * RequiredPackageVariableSource ) GetVariables (ctx context.Context , entitySource input.EntitySource ) ([]deppy.Variable , error ) {
91+ func (r * VariableSource ) GetVariables (ctx context.Context , entitySource input.EntitySource ) ([]deppy.Variable , error ) {
9292 resultSet , err := entitySource .Filter (ctx , input .And (r .predicates ... ))
9393 if err != nil {
9494 return nil , err
@@ -106,7 +106,7 @@ func (r *RequiredPackageVariableSource) GetVariables(ctx context.Context, entity
106106 }, nil
107107}
108108
109- func (r * RequiredPackageVariableSource ) notFoundError () error {
109+ func (r * VariableSource ) notFoundError () error {
110110 // TODO: update this error message when/if we decide to support version ranges as opposed to fixing the version
111111 // context: we originally wanted to support version ranges and take the highest version that satisfies the range
112112 // during the upstream call on the 2023-04-11 we decided to pin the version instead. But, we'll keep version range
0 commit comments