Skip to content

Commit befff0b

Browse files
Jakob Schmidkramerul
andcommitted
Rename CreateSourceWithFixedCache to NewKindWithFixedCache
Co-authored-by: Ulrich Kramer <u.kramer@sap.com>
1 parent cbaa31a commit befff0b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pkg/source/source.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,18 @@ type Source interface {
5555
Start(handler.EventHandler, workqueue.RateLimitingInterface, ...predicate.Predicate) error
5656
}
5757

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

64-
type sourceWithFixedCache struct {
65+
type kindWithFixedCache struct {
6566
kind Kind
6667
}
6768

68-
func (ks *sourceWithFixedCache) Start(handler handler.EventHandler, queue workqueue.RateLimitingInterface,
69+
func (ks *kindWithFixedCache) Start(handler handler.EventHandler, queue workqueue.RateLimitingInterface,
6970
prct ...predicate.Predicate) error {
7071
return ks.kind.Start(handler, queue, prct...)
7172
}

0 commit comments

Comments
 (0)