diff options
author | Valery Piashchynski <[email protected]> | 2021-09-16 17:12:37 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-09-16 17:12:37 +0300 |
commit | f3491c089b4da77fd8d2bc942a88b6b8d117a8a5 (patch) | |
tree | 32bfffb1f24eeee7b909747cc00a6a6b9fd3ee83 /priority_queue/interface.go | |
parent | 5d2cd55ab522d4f1e65a833f91146444465a32ac (diff) |
Move plugins to a separate repository
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'priority_queue/interface.go')
-rw-r--r-- | priority_queue/interface.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/priority_queue/interface.go b/priority_queue/interface.go new file mode 100644 index 00000000..9efa4652 --- /dev/null +++ b/priority_queue/interface.go @@ -0,0 +1,31 @@ +package priorityqueue + +type Queue interface { + Insert(item Item) + ExtractMin() Item + Len() uint64 +} + +// Item represents binary heap item +type Item interface { + // ID is a unique item identifier + ID() string + + // Priority returns the Item's priority to sort + Priority() int64 + + // Body is the Item payload + Body() []byte + + // Context is the Item meta information + Context() ([]byte, error) + + // Ack - acknowledge the Item after processing + Ack() error + + // Nack - discard the Item + Nack() error + + // Requeue - put the message back to the queue with the optional delay + Requeue(headers map[string][]string, delay int64) error +} |