que icon indicating copy to clipboard operation
que copied to clipboard

Priority Queues

Open sheharyarn opened this issue 5 years ago • 2 comments

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

sheharyarn avatar Aug 22 '19 00:08 sheharyarn

@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)

sheharyarn avatar Aug 22 '19 00:08 sheharyarn

Noted.

noizu avatar Jul 13 '22 20:07 noizu