Documentation ¶
Index ¶
- Variables
- func MarkDeleted(ctx context.Context, obj client.Object) client.Object
- func WasDeleted(ctx context.Context, obj client.Object) bool
- type Deleted
- type GVKNN
- type Interface
- type ObjectQueue
- func (q *ObjectQueue) Add(obj client.Object)
- func (q *ObjectQueue) Done(obj client.Object)
- func (q *ObjectQueue) Forget(obj client.Object)
- func (q *ObjectQueue) Get(ctx context.Context) (client.Object, error)
- func (q *ObjectQueue) Len() int
- func (q *ObjectQueue) Retry(obj client.Object)
- func (q *ObjectQueue) ShutDown()
- func (q *ObjectQueue) ShuttingDown() bool
Constants ¶
This section is empty.
Variables ¶
var ErrShutdown = errors.New("object queue shutting down")
ErrShutdown is returned by `ObjectQueue.Get` if the queue is shut down before an object is available/added.
Functions ¶
func MarkDeleted ¶
MarkDeleted marks the given Object as having been deleted from the cluster. On receiving a Deleted event, Watchers should call this *first* and then pass the returned Object to Add().
Types ¶
type Deleted ¶ added in v1.15.1
Deleted wraps an Object that has be deleted
func (*Deleted) DeepCopyObject ¶ added in v1.15.1
DeepCopyObject implements client.Object.
This ensures when we deepcopy a deleted object, we retain that it is deleted.
type GVKNN ¶
GVKNN adds Version to core.ID to make it suitable for getting an object from a cluster into an *unstructured.Unstructured.
func (GVKNN) GroupVersionKind ¶
func (gvknn GVKNN) GroupVersionKind() schema.GroupVersionKind
GroupVersionKind returns the GVK contained in this GVKNN.
type Interface ¶
type Interface interface { Add(obj client.Object) Get(context.Context) (client.Object, error) Done(obj client.Object) Forget(obj client.Object) Retry(obj client.Object) ShutDown() }
Interface is the methods ObjectQueue satisfies. See ObjectQueue for method definitions.
type ObjectQueue ¶
type ObjectQueue struct {
// contains filtered or unexported fields
}
ObjectQueue is a wrapper around a workqueue.Interface for use with declared resources. It deduplicates work items by their GVKNN. NOTE: This was originally designed to wrap a DelayingInterface, but we have had to copy a lot of that logic here. At some point it may make sense to remove the underlying workqueue.Interface and just consolidate copied logic here.
func New ¶
func New(name string) *ObjectQueue
New creates a new work queue for use in signalling objects that may need remediation.
func (*ObjectQueue) Add ¶
func (q *ObjectQueue) Add(obj client.Object)
Add marks the object as needing processing unless the object is already in the queue AND the existing object is more current than the new one.
func (*ObjectQueue) Done ¶
func (q *ObjectQueue) Done(obj client.Object)
Done marks item as done processing, and if it has been marked as dirty again while it was being processed, it will be re-added to the queue for re-processing.
func (*ObjectQueue) Forget ¶
func (q *ObjectQueue) Forget(obj client.Object)
Forget is a convenience method that allows callers to directly tell the RateLimitingInterface to forget a specific client.Object.
func (*ObjectQueue) Get ¶
Get blocks until one of the following conditions: A) An item is ready to be processed B) The context is cancelled or times out C) The queue is shutting down
Returns the next item to process, and either a `context.Canceled`, `context.DeadlineExceeded`, or `queue.ErrShutdown`.
If the queue has been shut down the caller should end their goroutine.
You must call Done with item when you have finished processing it or else the item will never be processed again.
func (*ObjectQueue) Len ¶
func (q *ObjectQueue) Len() int
Len returns the length of the underlying queue.
func (*ObjectQueue) Retry ¶
func (q *ObjectQueue) Retry(obj client.Object)
Retry schedules the object to be requeued using the rate limiter.
func (*ObjectQueue) ShutDown ¶
func (q *ObjectQueue) ShutDown()
ShutDown shuts down the object queue.
func (*ObjectQueue) ShuttingDown ¶
func (q *ObjectQueue) ShuttingDown() bool
ShuttingDown returns true if the object queue is shutting down.