que
que copied to clipboard
Priority Queues
Related to #19.
- [ ] Replace Erlang's
:queue
with a priority queue data structure - [ ] Update Mnesia Table definition
- [ ] Auto-migrate on update
- [ ] Update
Que.add
API to support options - [ ] Option validation
- [ ] Tests
- [ ] Docs and Readme
@noizu Instead of writing a custom implementation of priority queue, we might consider using erlang's built-in :gb_trees
or another lib that uses pairing heaps. One reason being we don't want to use atoms for each priority and instead use positive integers. We'll allow the users to use any integer in 0..10
as the priority for now, with the default being 5
. We might change this range in the future.
The Que.add
API should remain the same; priority and other future options should now be specified in the optional Keyword list opts
as the third argument. It would look like:
Que.add(SomeWorker, args, priority: 1)
Noted.