Skip to content

Commit

Permalink
Merge pull request #267 from shawn-hurley/feature/poc-multinamespaced…
Browse files Browse the repository at this point in the history
…-cache

⚠️ adding multi namespaces cache
  • Loading branch information
k8s-ci-robot authored Feb 22, 2019
2 parents 58a08d8 + fc804a4 commit 68ae79e
Show file tree
Hide file tree
Showing 7 changed files with 800 additions and 543 deletions.
23 changes: 20 additions & 3 deletions pkg/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ type Cache interface {
type Informers interface {
// GetInformer fetches or constructs an informer for the given object that corresponds to a single
// API kind and resource.
GetInformer(obj runtime.Object) (toolscache.SharedIndexInformer, error)
GetInformer(obj runtime.Object) (Informer, error)

// GetInformerForKind is similar to GetInformer, except that it takes a group-version-kind, instead
// of the underlying object.
GetInformerForKind(gvk schema.GroupVersionKind) (toolscache.SharedIndexInformer, error)
GetInformerForKind(gvk schema.GroupVersionKind) (Informer, error)

// Start runs all the informers known to this cache until the given channel is closed.
// It blocks.
Expand All @@ -68,7 +68,24 @@ type Informers interface {
client.FieldIndexer
}

// Options are the optional arguments for creating a new set of Informers.
// Informer - informer allows you interact with the underlying informer
type Informer interface {
// AddEventHandler adds an event handler to the shared informer using the shared informer's resync
// period. Events to a single handler are delivered sequentially, but there is no coordination
// between different handlers.
AddEventHandler(handler toolscache.ResourceEventHandler)
// AddEventHandlerWithResyncPeriod adds an event handler to the shared informer using the
// specified resync period. Events to a single handler are delivered sequentially, but there is
// no coordination between different handlers.
AddEventHandlerWithResyncPeriod(handler toolscache.ResourceEventHandler, resyncPeriod time.Duration)
// AddIndexers adds more indexers to this store. If you call this after you already have data
// in the store, the results are undefined.
AddIndexers(indexers toolscache.Indexers) error
//HasSynced return true if the informers underlying store has synced
HasSynced() bool
}

// Options are the optional arguments for creating a new InformersMap object
type Options struct {
// Scheme is the scheme to use for mapping objects to GroupVersionKinds
Scheme *runtime.Scheme
Expand Down
Loading

0 comments on commit 68ae79e

Please sign in to comment.