addIfNotPresent inserts deltas under id if it does not exist, and assumes the caller already holds the fifo lock.
(id string, deltas Deltas)
| 246 | // addIfNotPresent inserts deltas under id if it does not exist, and assumes the caller |
| 247 | // already holds the fifo lock. |
| 248 | func (f *DeltaFIFO) addIfNotPresent(id string, deltas Deltas) { |
| 249 | f.populated = true |
| 250 | if _, exists := f.items[id]; exists { |
| 251 | return |
| 252 | } |
| 253 | |
| 254 | f.queue = append(f.queue, id) |
| 255 | f.items[id] = deltas |
| 256 | f.cond.Broadcast() |
| 257 | } |
| 258 | |
| 259 | // re-listing and watching can deliver the same update multiple times in any |
| 260 | // order. This will combine the most recent two deltas if they are the same. |
no outgoing calls
no test coverage detected