GetByKey returns the complete list of deltas for the requested item, setting exists=false if that list is empty. You should treat the items returned inside the deltas as immutable.
(key string)
| 378 | // setting exists=false if that list is empty. |
| 379 | // You should treat the items returned inside the deltas as immutable. |
| 380 | func (f *DeltaFIFO) GetByKey(key string) (item interface{}, exists bool, err error) { |
| 381 | f.lock.RLock() |
| 382 | defer f.lock.RUnlock() |
| 383 | d, exists := f.items[key] |
| 384 | if exists { |
| 385 | // Copy item's slice so operations on this slice |
| 386 | // won't interfere with the object we return. |
| 387 | d = copyDeltas(d) |
| 388 | } |
| 389 | return d, exists, nil |
| 390 | } |
| 391 | |
| 392 | // Checks if the queue is closed |
| 393 | func (f *DeltaFIFO) IsClosed() bool { |