cache

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExistingOperator = OperatorSourceInfo{Package: "", Channel: "", StartingCSV: "", Catalog: NoCatalog, DefaultChannel: false}
View Source
var NoCatalog = SourceKey{Name: "", Namespace: ""}

Functions

func APIKeyToGVKHash

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

func APIKeyToGVKString

func APIKeyToGVKString(key opregistry.APIKey) string

func Matches

func Matches(o *Operator, p ...OperatorPredicate) bool

Types

type APIMultiOwnerSet

type APIMultiOwnerSet map[opregistry.APIKey]OperatorSet

func EmptyAPIMultiOwnerSet

func EmptyAPIMultiOwnerSet() APIMultiOwnerSet

func (APIMultiOwnerSet) PopAPIKey

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

func (APIMultiOwnerSet) PopAPIRequirers

func (s APIMultiOwnerSet) PopAPIRequirers() OperatorSet

type APIOwnerSet

type APIOwnerSet map[opregistry.APIKey]*Operator

func EmptyAPIOwnerSet

func EmptyAPIOwnerSet() APIOwnerSet

type APISet

type APISet map[opregistry.APIKey]struct{}

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) Expire

func (c *Cache) Expire(catalog SourceKey)

func (*Cache) Namespaced

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

type EmptyOperatorFinder

type EmptyOperatorFinder struct{}

func (EmptyOperatorFinder) Find

type MultiCatalogOperatorFinder

type MultiCatalogOperatorFinder interface {
	Catalog(SourceKey) OperatorFinder
	FindPreferred(preferred *SourceKey, preferredNamespace string, predicates ...OperatorPredicate) []*Operator
	WithExistingOperators(snapshot *Snapshot, namespace string) MultiCatalogOperatorFinder
	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 (*NamespacedOperatorCache) FindPreferred

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

func (*NamespacedOperatorCache) WithExistingOperators

func (c *NamespacedOperatorCache) WithExistingOperators(snapshot *Snapshot, namespace string) MultiCatalogOperatorFinder

type Operator

type Operator 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 AtLeast

func AtLeast(n int, operators []*Operator) ([]*Operator, error)

func ExactlyOne

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

func Filter

func Filter(operators []*Operator, p ...OperatorPredicate) []*Operator

func (*Operator) Channel

func (o *Operator) Channel() string

func (*Operator) Package

func (o *Operator) Package() string

type OperatorCacheProvider

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

type OperatorFinder

type OperatorFinder interface {
	Find(...OperatorPredicate) []*Operator
}

type OperatorPredicate

type OperatorPredicate interface {
	Test(*Operator) bool
	String() string
}

func BooleanPredicate

func BooleanPredicate(result bool) OperatorPredicate

func CSVNamePredicate

func CSVNamePredicate(name string) OperatorPredicate

func CatalogPredicate

func CatalogPredicate(key SourceKey) OperatorPredicate

func ChannelPredicate

func ChannelPredicate(channel string) OperatorPredicate

func CountingPredicate

func CountingPredicate(p OperatorPredicate, n *int) OperatorPredicate

func False

func False() OperatorPredicate

func LabelPredicate

func LabelPredicate(label string) OperatorPredicate

func PkgPredicate

func PkgPredicate(pkg string) OperatorPredicate

func ProvidingAPIPredicate

func ProvidingAPIPredicate(api opregistry.APIKey) OperatorPredicate

func ReplacesPredicate

func ReplacesPredicate(replaces string) OperatorPredicate

func SkipRangeIncludesPredicate

func SkipRangeIncludesPredicate(version semver.Version) OperatorPredicate

func True

func True() OperatorPredicate

func VersionInRangePredicate

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

type OperatorSet

type OperatorSet map[string]*Operator

func EmptyOperatorSet

func EmptyOperatorSet() OperatorSet

func (OperatorSet) Snapshot

func (o OperatorSet) Snapshot() OperatorSet

Snapshot returns a new set, pointing to the same values

type OperatorSourceInfo

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

func (*OperatorSourceInfo) String

func (i *OperatorSourceInfo) String() string

type Option

type Option func(*Cache)

func WithCatalogSourceLister

func WithCatalogSourceLister(catalogSourceLister v1alpha1.CatalogSourceLister) Option

func WithLogger

func WithLogger(logger logrus.StdLogger) Option

type Snapshot

type Snapshot struct {
	Entries []*Operator
}

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 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
JackTT - Gopher 🇻🇳