Skip to content

Interface design #16

Description

@e-kayrakli

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions