Distributed-Data-Structures
Distributed-Data-Structures copied to clipboard
Interface design
An issue to keep track of API discussion
Standard must-haves
-
proc Queue(type eltType)
- an optional size argument?
- some param/const flags?
- an optional "targetLocales"?
-
proc enqueue(elt :eltType)
- possibly a vararg implementation
-
proc dequeue(): (bool, eltType)
-
proc clear()
-
proc length
-
proc size (equivalent to length)
-
proc isEmtpy
Some brainstorming:
Utilities:
-
iter these()
- Most likely the whole 4 iterators: sequential, leader, follower, standalone
-
proc copy() -- or clone, something for deep-copy
Handling asynchrony:
- proc sync()
- proc asyncEnqueue(elt :eltType)
- proc asyncDequeue(elt :eltType): (bool, eltType)
- Maybe you can allow both synchronous and asynchronous operations to the queue? Then you'd need something like these. If the queue doesn't allow asynchrony due to some configuration parameters (likely params), you can throw a compiler warning in these functions and fallback to regular enqueue/dequeue
Bulk operations:
-
proc enqueueBulk(elt: [] eltType)
-
proc dequeueBulk(numElems): (bool, [] eltType)
-
proc concat(otherQueue)
- Obviously the same thing as enqueueBulk, you can pick one or have both signatures available
-
proc +=(q: Queue, elts)
-
proc +=(q: Queue, otherQueue)
- Such operators are supported in sparse and associative domains
Bounded queue:
- proc capacity
- proc requestCapacity(newCap)
- proc isFull