class UnifiedQueues::Single::Driver::RubyPriorityQueueDriver
Ruby fibonacci heap priority queue driver. Uses the RubyPriorityQueue
class from PriorityQueue
gem. Priority is supported.
It isn't implement equivalent of the #clear
method, so it falls backs to naive “popping” style clearing.
Public Instance Methods
Indicates queue is empty. Note, it isn't implemented in this implementation.
@param [Boolean] true
if it's, false
otherwise
# File lib/unified-queues/single/driver/priority_queue.rb, line 191 def empty? @native.empty? end
Returns length of the queue. Note, it isn't implemented in this implementation.
@return [Integer]
# File lib/unified-queues/single/driver/priority_queue.rb, line 202 def length @native.length end
Pops value out of the queue. Note, value with minimal priority will be popped out. Blocking isn't supported.
@param [Boolean|Integer] blocking true
or timeout if it should block, false
otherwise @return [Object] queued value
# File lib/unified-queues/single/driver/priority_queue.rb, line 180 def pop(blocking = false) @native.delete_min_return_key end
Pushes the value into the queue. Priority is supported.
@param [Object] value value for push @param [Object] key key for priority queues
# File lib/unified-queues/single/driver/priority_queue.rb, line 168 def push(value, key = value) @native.push(value, key) end
Returs type of the queue. @return [:linear]
# File lib/unified-queues/single/driver/priority_queue.rb, line 211 def type :linear end