-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#48]: feature: priority queue
v2
API
- Loading branch information
Showing
5 changed files
with
65 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package lock | ||
|
||
import pq "github.com/roadrunner-server/api/v4/plugins/v2/priority_queue" | ||
|
||
// Queue represents Lock plugin queue with it's elements types inside | ||
type Queue interface { | ||
// Remove removes element with provided ID (if exists) and returns that elements | ||
Remove(id string) []pq.Item | ||
// Insert adds an item to the queue | ||
Insert(item pq.Item) | ||
// ExtractMin returns the item with the highest priority (less value is the highest priority) | ||
ExtractMin() pq.Item | ||
// Len returns the number of items in the queue | ||
Len() uint64 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package priority_queue | ||
|
||
// Item interface represents the base meta-information which any priority queue message must have | ||
type Item interface { | ||
// ID returns a unique identifier for the item | ||
ID() string | ||
// GroupID returns the group associated with the item, used to remove all items with the same groupID | ||
GroupID() string | ||
// Priority returns the priority level used to sort the item | ||
Priority() int64 | ||
} |