Enqueue adds the op to the queue and prevents any other items to be added with this key
(op T)
| 22 | |
| 23 | // Enqueue adds the op to the queue and prevents any other items to be added with this key |
| 24 | func (f *ExclusiveQueues[T]) Enqueue(op T) error { |
| 25 | _, loaded := f.activeKeys.LoadOrStore(op.Key(), struct{}{}) |
| 26 | if loaded { |
| 27 | return nil |
| 28 | } |
| 29 | |
| 30 | return f.Requeue(op) |
| 31 | } |
| 32 | |
| 33 | // Dequeue removes the next op from the queue. After dequeueing the calling |
| 34 | // process either needs to call Clear or Requeue. |