diff options
Diffstat (limited to 'pkg/priority_queue/interface.go')
-rw-r--r-- | pkg/priority_queue/interface.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/pkg/priority_queue/interface.go b/pkg/priority_queue/interface.go new file mode 100644 index 00000000..8278dc8d --- /dev/null +++ b/pkg/priority_queue/interface.go @@ -0,0 +1,28 @@ +package priorityqueue + +type Queue interface { + Insert(item Item) + GetMax() 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() uint64 + + // 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 +} |