LifoQueue

LifoQueue

A Last-In-First-Out Queue. Items are dequeued in the opposite order that they are enqueued.

Constructor

new LifoQueue()

Source:
See:

Extends

Members

full :boolean

Source:
Inherited From:
true if a call to put would block.
Type:
  • boolean

maxsize :Number

Source:
Inherited From:
The maximum number of items that can be enqueued.
Type:
  • Number

size :Number

Source:
Inherited From:
The number of items waiting to be dequeued.
Type:
  • Number

Methods

(protected) _get()

Source:
Overrides:

(protected) _put()

Source:
Inherited From:

(async) get(optionsopt) → {Future.<*>}

Source:
Inherited From:
Get an item from the queue if it is not empty. The returned Future MUST be cancelled if the caller is no longer wanting the queue item.
Parameters:
Name Type Attributes Description
options QueueWaitOptions <optional>
Returns:
An item from the head of the queue.
Type
Future.<*>

(async) getAll(optionsopt) → {Future.<Array.<*>>}

Source:
Inherited From:
Get all items from the queue. If the queue cannot satisfy the size requirements then it will block. The returned Future MUST be cancelled if the caller is no longer wanting the queue items.
Parameters:
Name Type Attributes Description
options QueueWaitOptions <optional>
Returns:
A Future that resolves with an Array of items from the queue.
Type
Future.<Array.<*>>

getAllNoWait() → {Array.<*>}

Source:
Inherited From:
Get all items from the queue without waiting.
Returns:
An Array of items from the queue.
Type
Array.<*>

getNoWait() → {*}

Source:
Inherited From:
Get an item from the queue if it is not empty.
Throws:
Returns:
An item from the head of the queue.
Type
*

(async) join() → {Future.<boolean>}

Source:
Inherited From:
Will block until all items are dequeued and for every item that was dequeued a call was made to taskdone.
Returns:
true
Type
Future.<boolean>

(async) put(item)

Source:
Inherited From:
Place a new item in the queue if it is not full. Otherwise block until space is available.
Parameters:
Name Type Description
item * Any object to pass to the caller of dequeue.

putNoWait(item)

Source:
Inherited From:
Place a new item in the queue if it is not full.
Parameters:
Name Type Description
item * Any object to pass to the caller of dequeue.
Throws:

taskDone(countopt)

Source:
Inherited From:
Decrement the number of pending tasks. Called by consumers after completing their use of a dequeued item to indicate that processing has finished. When all dequeued items have been accounted for with an accompanying call to this function join will unblock.
Parameters:
Name Type Attributes Default Description
count Number <optional>
1 The number of tasks to mark as done.

(async) wait(optionsopt) → {Future}

Source:
Inherited From:
Wait for an item to be available. Users should cancel the returned Future if they are no longer wanting data. Such as when used in Promise.race.
Parameters:
Name Type Attributes Description
options QueueWaitOptions <optional>
Returns:
Resolves when data is available to get.
Type
Future