type PopProcessFunc … type ErrRequeue … var ErrFIFOClosed … func (e ErrRequeue) Error() string { … } type Queue … // Pop is helper function for popping from Queue. // WARNING: Do NOT use this function in non-test code to avoid races // unless you really really really really know what you are doing. // // NOTE: This function is deprecated and may be removed in the future without // additional warning. func Pop(queue Queue) interface{ … } type FIFO … var _ … // Close the queue. func (f *FIFO) Close() { … } // HasSynced returns true if an Add/Update/Delete/AddIfNotPresent are called first, // or the first batch of items inserted by Replace() has been popped. func (f *FIFO) HasSynced() bool { … } func (f *FIFO) hasSynced_locked() bool { … } // Add inserts an item, and puts it in the queue. The item is only enqueued // if it doesn't already exist in the set. func (f *FIFO) Add(obj interface{ … } // AddIfNotPresent inserts an item, and puts it in the queue. If the item is already // present in the set, it is neither enqueued nor added to the set. // // This is useful in a single producer/consumer scenario so that the consumer can // safely retry items without contending with the producer and potentially enqueueing // stale items. func (f *FIFO) AddIfNotPresent(obj interface{ … } // addIfNotPresent assumes the fifo lock is already held and adds the provided // item to the queue under id if it does not already exist. func (f *FIFO) addIfNotPresent(id string, obj interface{ … } // Update is the same as Add in this implementation. func (f *FIFO) Update(obj interface{ … } // Delete removes an item. It doesn't add it to the queue, because // this implementation assumes the consumer only cares about the objects, // not the order in which they were created/added. func (f *FIFO) Delete(obj interface{ … } // List returns a list of all the items. func (f *FIFO) List() []interface{ … } // ListKeys returns a list of all the keys of the objects currently // in the FIFO. func (f *FIFO) ListKeys() []string { … } // Get returns the requested item, or sets exists=false. func (f *FIFO) Get(obj interface{ … } // GetByKey returns the requested item, or sets exists=false. func (f *FIFO) GetByKey(key string) (item interface{ … } // IsClosed checks if the queue is closed func (f *FIFO) IsClosed() bool { … } // Pop waits until an item is ready and processes it. If multiple items are // ready, they are returned in the order in which they were added/updated. // The item is removed from the queue (and the store) before it is processed, // so if you don't successfully process it, it should be added back with // AddIfNotPresent(). process function is called under lock, so it is safe // update data structures in it that need to be in sync with the queue. func (f *FIFO) Pop(process PopProcessFunc) (interface{ … } // Replace will delete the contents of 'f', using instead the given map. // 'f' takes ownership of the map, you should not reference the map again // after calling this function. f's queue is reset, too; upon return, it // will contain the items in the map, in no particular order. func (f *FIFO) Replace(list []interface{ … } // Resync will ensure that every object in the Store has its key in the queue. // This should be a no-op, because that property is maintained by all operations. func (f *FIFO) Resync() error { … } // NewFIFO returns a Store which can be used to queue up items to // process. func NewFIFO(keyFunc KeyFunc) *FIFO { … }