Skip to content

Commit

Permalink
lint changes
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Macdonald <austin@redhat.com>
  • Loading branch information
asmacdo committed Sep 19, 2022
1 parent 320a917 commit e3c6709
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 22 deletions.
10 changes: 5 additions & 5 deletions alpha/declcfg/declcfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ type ChannelEntry struct {
// Top-level fields are the source of truth, i.e. not CSV values.
//
// Notes:
// - Any field slice type field or type containing a slice somewhere
// where two types/fields are equal if their contents are equal regardless
// of order must have a `hash:"set"` field tag for bundle comparison.
// - Any fields that have a `json:"-"` tag must be included in the equality
// evaluation in bundlesEqual().
// - Any field slice type field or type containing a slice somewhere
// where two types/fields are equal if their contents are equal regardless
// of order must have a `hash:"set"` field tag for bundle comparison.
// - Any fields that have a `json:"-"` tag must be included in the equality
// evaluation in bundlesEqual().
type Bundle struct {
Schema string `json:"schema"`
Name string `json:"name"`
Expand Down
15 changes: 8 additions & 7 deletions alpha/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,9 @@ type Channel struct {
}

// TODO(joelanford): This function determines the channel head by finding the bundle that has 0
// incoming edges, based on replaces and skips. It also expects to find exactly one such bundle.
// Is this the correct algorithm?
//
// incoming edges, based on replaces and skips. It also expects to find exactly one such bundle.
// Is this the correct algorithm?
func (c Channel) Head() (*Bundle, error) {
incoming := map[string]int{}
for _, b := range c.Bundles {
Expand Down Expand Up @@ -210,11 +211,11 @@ func (c *Channel) Validate() error {

// validateReplacesChain checks the replaces chain of a channel.
// Specifically the following rules must be followed:
// 1. There must be exactly 1 channel head.
// 2. Beginning at the head, the replaces chain must reach all non-skipped entries.
// Non-skipped entries are defined as entries that are not skipped by any other entry in the channel.
// 3. There must be no cycles in the replaces chain.
// 4. The tail entry in the replaces chain is permitted to replace a non-existent entry.
// 1. There must be exactly 1 channel head.
// 2. Beginning at the head, the replaces chain must reach all non-skipped entries.
// Non-skipped entries are defined as entries that are not skipped by any other entry in the channel.
// 3. There must be no cycles in the replaces chain.
// 4. The tail entry in the replaces chain is permitted to replace a non-existent entry.
func (c *Channel) validateReplacesChain() error {
head, err := c.Head()
if err != nil {
Expand Down
10 changes: 6 additions & 4 deletions alpha/property/property.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ type Package struct {
}

// NOTICE: The Channel properties are for internal use only.
// DO NOT use it for any public-facing functionalities.
// This API is in alpha stage and it is subject to change.
//
// DO NOT use it for any public-facing functionalities.
// This API is in alpha stage and it is subject to change.
type Channel struct {
ChannelName string `json:"channelName"`
//Priority string `json:"priority"`
Expand Down Expand Up @@ -287,8 +288,9 @@ func MustBuildBundleObjectData(data []byte) Property {
}

// NOTICE: The Channel properties are for internal use only.
// DO NOT use it for any public-facing functionalities.
// This API is in alpha stage and it is subject to change.
//
// DO NOT use it for any public-facing functionalities.
// This API is in alpha stage and it is subject to change.
func MustBuildChannelPriority(name string, priority int) Property {
return MustBuild(&Channel{ChannelName: name, Priority: priority})
}
2 changes: 2 additions & 0 deletions pkg/lib/indexer/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

// IndexAdder allows the creation of index container images from scratch or
// based on previous index images
//
//counterfeiter:generate . IndexAdder
type IndexAdder interface {
AddToIndex(AddToIndexRequest) error
Expand All @@ -29,6 +30,7 @@ func NewIndexAdder(buildTool, pullTool containertools.ContainerTool, logger *log

// IndexDeleter takes indexes and deletes all references to an operator
// from them
//
//counterfeiter:generate . IndexDeleter
type IndexDeleter interface {
DeleteFromIndex(DeleteFromIndexRequest) error
Expand Down
13 changes: 7 additions & 6 deletions pkg/registry/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,13 @@ func (q Querier) GetChannelEntriesThatProvide(_ context.Context, group, version,
}

// TODO(joelanford): Need to review the expected functionality of this function. I ran
// some experiments with the sqlite version of this function and it seems to only return
// channel heads that provide the GVK (rather than searching down the graph if parent bundles
// don't provide the API). Based on that, this function currently looks at channel heads only.
// ---
// Separate, but possibly related, I noticed there are several channels in the channel entry
// table who's minimum depth is 1. What causes 1 to be minimum depth in some cases and 0 in others?
//
// some experiments with the sqlite version of this function and it seems to only return
// channel heads that provide the GVK (rather than searching down the graph if parent bundles
// don't provide the API). Based on that, this function currently looks at channel heads only.
// ---
// Separate, but possibly related, I noticed there are several channels in the channel entry
// table who's minimum depth is 1. What causes 1 to be minimum depth in some cases and 0 in others?
func (q Querier) GetLatestChannelEntriesThatProvide(_ context.Context, group, version, kind string) ([]*ChannelEntry, error) {
var entries []*ChannelEntry

Expand Down

0 comments on commit e3c6709

Please sign in to comment.