cache

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIKeyToGVKHash

func APIKeyToGVKHash(key opregistry.APIKey) (string, error)

func APIKeyToGVKString

func APIKeyToGVKString(key opregistry.APIKey) string

func Matches

func Matches(o *Entry, p ...Predicate) bool

func ValidOnce added in v0.21.0

func ValidOnce() <-chan struct{}

Types

type APISet

type APISet map[opregistry.APIKey]struct{}

todo: drop fields from cache.Entry and move to pkg/controller/operators/olm

func EmptyAPISet

func EmptyAPISet() APISet

func GVKStringToProvidedAPISet

func GVKStringToProvidedAPISet(gvksStr string) APISet

func (APISet) Difference

func (s APISet) Difference(set APISet) APISet

func (APISet) Intersection

func (s APISet) Intersection(sets ...APISet) APISet

Intersection returns the intersection of the APISet and the given list of APISets

func (APISet) IsSubset

func (s APISet) IsSubset(set APISet) bool

IsSubset returns true if the APISet is a subset of the given one

func (APISet) PopAPIKey

func (s APISet) PopAPIKey() *opregistry.APIKey

func (APISet) String

func (s APISet) String() string

func (APISet) StripPlural

func (s APISet) StripPlural() APISet

StripPlural returns the APISet with the Plural field of all APIKeys removed

func (APISet) Union

func (s APISet) Union(sets ...APISet) APISet

Union returns the union of the APISet and the given list of APISets

type Cache

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

func New

func New(sp SourceProvider, options ...Option) *Cache

func (*Cache) Namespaced

func (c *Cache) Namespaced(namespaces ...string) MultiCatalogOperatorFinder

type Deprecations added in v0.27.0

type Deprecations struct {
	Package *api.Deprecation
	Channel *api.Deprecation
	Bundle  *api.Deprecation
}

type EmptyOperatorFinder

type EmptyOperatorFinder struct{}

func (EmptyOperatorFinder) Find

func (f EmptyOperatorFinder) Find(...Predicate) []*Entry

type Entry added in v0.20.0

type Entry struct {
	Name         string
	Replaces     string
	Skips        []string
	SkipRange    semver.Range
	ProvidedAPIs APISet
	RequiredAPIs APISet
	Version      *semver.Version
	SourceInfo   *OperatorSourceInfo
	Properties   []*api.Property
	BundlePath   string

	// Present exclusively to pipe inlined bundle
	// content. Resolver components shouldn't need to read this,
	// and it should eventually be possible to remove the field
	// altogether.
	Bundle *api.Bundle
}

func ExactlyOne

func ExactlyOne(operators []*Entry) (*Entry, error)

func Filter

func Filter(operators []*Entry, p ...Predicate) []*Entry

func (*Entry) Channel added in v0.20.0

func (o *Entry) Channel() string

func (*Entry) Package added in v0.20.0

func (o *Entry) Package() string

type MultiCatalogOperatorFinder

type MultiCatalogOperatorFinder interface {
	Catalog(SourceKey) OperatorFinder
	FindPreferred(preferred *SourceKey, preferredNamespace string, predicates ...Predicate) []*Entry
	Error() error
	OperatorFinder
}

type NamespacedOperatorCache

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

func (*NamespacedOperatorCache) Catalog

func (*NamespacedOperatorCache) Error

func (c *NamespacedOperatorCache) Error() error

func (*NamespacedOperatorCache) Find

func (c *NamespacedOperatorCache) Find(p ...Predicate) []*Entry

func (*NamespacedOperatorCache) FindPreferred

func (c *NamespacedOperatorCache) FindPreferred(preferred *SourceKey, preferredNamespace string, p ...Predicate) []*Entry

type OperatorCacheProvider

type OperatorCacheProvider interface {
	Namespaced(namespaces ...string) MultiCatalogOperatorFinder
}

type OperatorFinder

type OperatorFinder interface {
	Find(...Predicate) []*Entry
}

type OperatorSourceInfo

type OperatorSourceInfo struct {
	Package        string
	Channel        string
	StartingCSV    string
	Catalog        SourceKey
	DefaultChannel bool
	Deprecations   *Deprecations
	Subscription   *v1alpha1.Subscription
}

func (*OperatorSourceInfo) String

func (i *OperatorSourceInfo) String() string

type Option

type Option func(*Cache)

func WithLogger

func WithLogger(logger logrus.StdLogger) Option

func WithSourcePriorityProvider added in v0.21.0

func WithSourcePriorityProvider(spp SourcePriorityProvider) Option

type Predicate added in v0.20.0

type Predicate interface {
	Test(*Entry) bool
	String() string
}

func And

func And(p ...Predicate) Predicate

func BooleanPredicate

func BooleanPredicate(result bool) Predicate

func CSVNamePredicate

func CSVNamePredicate(name string) Predicate

func CatalogPredicate

func CatalogPredicate(key SourceKey) Predicate

func ChannelPredicate

func ChannelPredicate(channel string) Predicate

func CountingPredicate

func CountingPredicate(p Predicate, n *int) Predicate

func CreateCelPredicate added in v0.20.0

func CreateCelPredicate(env *constraints.CelEnvironment, rule string, failureMessage string) (Predicate, error)

func False

func False() Predicate

func LabelPredicate

func LabelPredicate(label string) Predicate

func Not added in v0.20.0

func Not(p ...Predicate) Predicate

func Or

func Or(p ...Predicate) Predicate

func PkgPredicate

func PkgPredicate(pkg string) Predicate

func ProvidingAPIPredicate

func ProvidingAPIPredicate(api opregistry.APIKey) Predicate

func ReplacesPredicate

func ReplacesPredicate(replaces string) Predicate

func SkipRangeIncludesPredicate

func SkipRangeIncludesPredicate(version semver.Version) Predicate

func True

func True() Predicate

func VersionInRangePredicate

func VersionInRangePredicate(r semver.Range, version string) Predicate

type Snapshot

type Snapshot struct {
	Entries []*Entry

	// Unless closed, the Snapshot is valid.
	Valid <-chan struct{}
}

func (*Snapshot) Snapshot

func (s *Snapshot) Snapshot(context.Context) (*Snapshot, error)

type Source

type Source interface {
	Snapshot(context.Context) (*Snapshot, error)
}

type SourceKey

type SourceKey struct {
	Name      string
	Namespace string
}

func NewVirtualSourceKey

func NewVirtualSourceKey(namespace string) SourceKey

func (*SourceKey) Empty

func (k *SourceKey) Empty() bool

func (*SourceKey) Equal

func (k *SourceKey) Equal(compare SourceKey) bool

func (*SourceKey) String

func (k *SourceKey) String() string

func (*SourceKey) Virtual

func (k *SourceKey) Virtual() bool

Virtual indicates if this is a "virtual" catalog representing the currently installed operators in a namespace

type SourcePriorityProvider added in v0.21.0

type SourcePriorityProvider interface {
	Priority(SourceKey) int
}

type SourceProvider

type SourceProvider interface {
	// TODO: namespaces parameter is an artifact of SourceStore
	Sources(namespaces ...string) map[SourceKey]Source
}

type StaticSourceProvider

type StaticSourceProvider map[SourceKey]Source

func (StaticSourceProvider) Sources

func (p StaticSourceProvider) Sources(namespaces ...string) map[SourceKey]Source

Jump to

Keyboard shortcuts

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