FIFO receives adds and updates from a Reflector, and puts them in a queue for FIFO order processing. If multiple adds/updates of a single item happen while an item is in the queue before it has been processed, it will only be processed once, and when it is processed, the most recent version will be
| 91 | // * You do not want to periodically reprocess objects. |
| 92 | // Compare with DeltaFIFO for other use cases. |
| 93 | type FIFO struct { |
| 94 | lock sync.RWMutex |
| 95 | cond sync.Cond |
| 96 | // We depend on the property that items in the set are in the queue and vice versa. |
| 97 | items map[string]interface{} |
| 98 | queue []string |
| 99 | |
| 100 | // populated is true if the first batch of items inserted by Replace() has been populated |
| 101 | // or Delete/Add/Update was called first. |
| 102 | populated bool |
| 103 | // initialPopulationCount is the number of items inserted by the first call of Replace() |
| 104 | initialPopulationCount int |
| 105 | |
| 106 | // keyFunc is used to make the key used for queued item insertion and retrieval, and |
| 107 | // should be deterministic. |
| 108 | keyFunc KeyFunc |
| 109 | |
| 110 | // Indication the queue is closed. |
| 111 | // Used to indicate a queue is closed so a control loop can exit when a queue is empty. |
| 112 | // Currently, not used to gate any of CRED operations. |
| 113 | closed bool |
| 114 | closedLock sync.Mutex |
| 115 | } |
| 116 | |
| 117 | var ( |
| 118 | _ = Queue(&FIFO{}) // FIFO is a Queue |
nothing calls this directly
no outgoing calls
no test coverage detected