{"modulePath":"github.com/operator-framework/operator-lifecycle-manager","version":"v0.46.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package queueinformer\n\n## Constants\n\n```go\nconst DefaultResyncPeriod = 15 * time.Minute\n```\n\n## Functions\n\n```go\nfunc NewLoopID() string\n```\n\n```go\nfunc ResyncWithJitter(resyncPeriod time.Duration, factor float64) func() time.Duration\n```\nResyncWithJitter takes a resync interval and adds jitter within a percent difference. factor is a value between 0 and 1 indicating the amount of jitter a factor of 0.2 and a period of 10m will have a range of 8 to 12 minutes (20%)\n\n## Types\n\n```go\ntype ExtensibleOperator interface {\n\t// RegisterQueueInformer registers the given QueueInformer with the Operator.\n\t// This method returns an error if the Operator has already been started.\n\tRegisterQueueInformer(queueInformer *QueueInformer) error\n\n\t// RegisterInformer registers an informer with the Operator.\n\t// This method returns an error if the Operator has already been started.\n\tRegisterInformer(cache.SharedIndexInformer) error\n}\n```\nExtensibleOperator describes a Reconciler that can be extended with additional informers and queue informers\n\n```go\ntype LegacySyncHandler func(obj interface{}) error\n```\nLegacySyncHandler is a deprecated signature for syncing resources.\n\n```go\nfunc (l LegacySyncHandler) ToSyncer() kubestate.Syncer\n```\nToSyncer returns the Syncer equivalent of the sync handler.\n\n```go\ntype ObservableOperator interface {\n\t// Ready returns a channel that is closed when the Operator is ready to run.\n\tReady() \u003c-chan struct{}\n\n\t// Done returns a channel that is closed when the Operator is done running.\n\tDone() \u003c-chan struct{}\n\n\t// AtLevel returns a channel that emits errors when the Operator is not at level.\n\tAtLevel() \u003c-chan error\n\n\t// Started returns true if RunInformers() has been called, false otherwise.\n\tStarted() bool\n\n\t// HasSynced returns true if the Operator's Informers have synced, false otherwise.\n\tHasSynced() bool\n}\n```\nObservableOperator describes a Reconciler whose state can be queried\n\n```go\ntype Operator interface {\n\tObservableOperator\n\tExtensibleOperator\n\t// RunInformers starts the Operator's underlying Informers.\n\tRunInformers(ctx context.Context)\n\n\t// Run starts the Operator and its underlying Informers.\n\tRun(ctx context.Context)\n}\n```\nOperator describes a Reconciler that manages a set of QueueInformers.\n\n```go\nfunc NewOperator(sv discovery.ServerVersionInterface, options ...OperatorOption) (Operator, error)\n```\nNewOperator returns a new Operator configured to manage the cluster with the given server version client.\n\n```go\ntype OperatorOption func(*operatorConfig)\n```\n\n```go\nfunc WithInformers(informers ...cache.SharedIndexInformer) OperatorOption\n```\nWithInformers registers a set of initial Informers with an Operator.\n\n```go\nfunc WithNumWorkers(numWorkers int) OperatorOption\n```\nWithNumWorkers sets the number of workers an Operator uses to process each queue. It translates directly to the number of queue items processed in parallel for a given queue. Specifying zero or less workers is an invariant and will cause an error upon configuration. Specifying one worker indicates that each queue will only have one item processed at a time.\n\n```go\nfunc WithOperatorLogger(logger *logrus.Logger) OperatorOption\n```\nWithOperatorLogger sets the logger used by an Operator.\n\n```go\nfunc WithQueueInformers(queueInformers ...*QueueInformer) OperatorOption\n```\nWithQueueInformers registers a set of initial QueueInformers with an Operator. If the QueueInformer is configured with a SharedIndexInformer, that SharedIndexInformer is registered with the Operator automatically.\n\n```go\ntype Option func(config *queueInformerConfig)\n```\nOption applies an option to the given queue informer config.\n\n```go\nfunc WithDeletionHandler(onDelete func(obj interface{})) Option\n```\n\n```go\nfunc WithIndexer(indexer cache.Indexer) Option\n```\nWithIndexer sets the indexer used by a QueueInformer.\n\n```go\nfunc WithInformer(informer cache.SharedIndexInformer) Option\n```\nWithInformer sets the informer used by a QueueInformer.\n\n```go\nfunc WithLogger(logger *logrus.Logger) Option\n```\nWithLogger configures logger as the QueueInformer's Logger.\n\n```go\nfunc WithMetricsProvider(provider metrics.MetricsProvider) Option\n```\nWithMetricsProvider configures the QueueInformer's MetricsProvider as provider.\n\n```go\nfunc WithQueue(queue workqueue.TypedRateLimitingInterface[types.NamespacedName]) Option\n```\nWithQueue sets the queue used by a QueueInformer.\n\n```go\nfunc WithSyncer(syncer kubestate.Syncer) Option\n```\nWithSyncer sets the syncer invoked by a QueueInformer.\n\n```go\ntype QueueInformer struct {\n\tmetrics.MetricsProvider\n\t// contains filtered or unexported fields\n}\n```\nQueueInformer ties an informer to a queue in order to process events from the informer the informer watches objects of interest and adds objects to the queue for processing the syncHandler is called for all objects on the queue\n\n```go\nfunc NewQueueInformer(ctx context.Context, options ...Option) (*QueueInformer, error)\n```\nNewQueueInformer returns a new QueueInformer configured with options.\n\n```go\nfunc (q *QueueInformer) Enqueue(item types.NamespacedName)\n```\nEnqueue adds a key to the queue. If obj is a key already it gets added directly.\n\n```go\nfunc (q *QueueInformer) Sync(ctx context.Context, obj client.Object) error\n```\nSync invokes all registered sync handlers in the QueueInformer's chain\n\n```go\ntype ResourceQueueSet struct {\n\t// contains filtered or unexported fields\n}\n```\nResourceQueueSet is a set of workqueues that is assumed to be keyed by namespace\n\n```go\nfunc NewEmptyResourceQueueSet() *ResourceQueueSet\n```\nNewEmptyResourceQueueSet returns a new queue set with an empty but initialized queue map\n\n```go\nfunc NewResourceQueueSet(queueSet map[string]workqueue.TypedRateLimitingInterface[types.NamespacedName]) *ResourceQueueSet\n```\nNewResourceQueueSet returns a new queue set with the given queue map\n\n```go\nfunc (r *ResourceQueueSet) Requeue(namespace, name string) error\n```\nRequeue requeues the resource in the set with the given name and namespace\n\n```go\nfunc (r *ResourceQueueSet) RequeueAfter(namespace, name string, duration time.Duration) error\n```\nTODO: this may not actually be required if the requeue is done on the namespace rather than the installplan RequeueAfter requeues the resource in the set with the given name and namespace (just like Requeue), but only does so after duration has passed\n\n```go\nfunc (r *ResourceQueueSet) Set(key string, queue workqueue.TypedRateLimitingInterface[types.NamespacedName])\n```\nSet sets the queue at the given key\n\n","path":"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer","name":"queueinformer","synopsis":"","isRedistributable":true}
