Skip to content

Commit

Permalink
Rename CreateSourceWithFixedCache to NewKindWithFixedCache
Browse files Browse the repository at this point in the history
Co-authored-by: Ulrich Kramer <u.kramer@sap.com>
  • Loading branch information
Jakob Schmid and kramerul committed Feb 10, 2020
1 parent cbaa31a commit befff0b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pkg/source/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,18 @@ type Source interface {
Start(handler.EventHandler, workqueue.RateLimitingInterface, ...predicate.Predicate) error
}

// CreateSourceWithFixedCache creates a Source without InjectCache, so that it is assured that the given cache is used
// and not overwritten
func CreateSourceWithFixedCache(object runtime.Object, cache cache.Cache) Source {
return &sourceWithFixedCache{kind: Kind{Type: object, cache: cache}}
// NewKindWithFixedCache creates a Source without InjectCache, so that it is assured that the given cache is used
// and not overwritten. It can be used to watch objects in a different cluster by passing the cache
// from that other cluster
func NewKindWithFixedCache(object runtime.Object, cache cache.Cache) Source {
return &kindWithFixedCache{kind: Kind{Type: object, cache: cache}}
}

type sourceWithFixedCache struct {
type kindWithFixedCache struct {
kind Kind
}

func (ks *sourceWithFixedCache) Start(handler handler.EventHandler, queue workqueue.RateLimitingInterface,
func (ks *kindWithFixedCache) Start(handler handler.EventHandler, queue workqueue.RateLimitingInterface,
prct ...predicate.Predicate) error {
return ks.kind.Start(handler, queue, prct...)
}
Expand Down

0 comments on commit befff0b

Please sign in to comment.