class AvalancheMQ::Queue::ReadyQueue

Overview

ReadyQueue is a sorted Deque of SegmentPositions

Direct Known Subclasses

Defined in:

avalanchemq/queue/ready.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(inital_capacity = 1024) #

[View source]

Instance Method Detail

def <<(sp) #

alias for #push


[View source]
def [](idx) #

[View source]
def []?(idx) #

[View source]
def bsearch_index(&) #

[View source]
def capacity #

[View source]
def compact #

[View source]
def delete(sp) : Bool #

Deletes a SP somewhere in the deque returns true/false whether found


[View source]
def each(start : Int, count : Int, &) #

[View source]
def each(&) #

Iterate over all SPs in the deque, locking while reading


[View source]
def empty? #

[View source]
def first? #

[View source]
def includes?(sp) #

[View source]
def insert(sp : SegmentPosition) #

insert a SP, keeps the deque sorted returns SPs in the deque after the operation


[View source]
def insert(sps : Enumerable(SegmentPosition)) #

Insert SPs sorted, the array should ideally be sorted too


[View source]
def limit_byte_size(bytesize, &blk : SegmentPosition -> Nil) #

[View source]
def limit_size(size, &blk : SegmentPosition -> Nil) #

[View source]
def lock #

[View source]
def locked_each(&) #

[View source]
def purge #

yields all messages, then clears it returns number of messages in the queue before purge


[View source]
def push(sp : SegmentPosition) : Int32 #

Pushes a SP to the end of the deque Returns number of SPs in the deque


[View source]
def shift #

[View source]
def shift(&blk : SegmentPosition -> Bool) #

Shift until block breaks or it returns false If broken with false yield, return the message to the queue


[View source]
def shift? #

[View source]
def size #

[View source]
def sum(&blk : SegmentPosition -> _) : UInt64 #

[View source]
def to_a #

[View source]
def unlock #

[View source]
def with_all(&blk : Iterator(SegmentPosition) -> Nil) #

Yields an iterator over all SPs, the deque is locked while it's being read from


[View source]