class PrivateParlorXT::MessageQueue

Overview

A container for messages ready to be sent to Telegram

Defined in:

private-parlor-xt/relay/queue.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def enqueue(cached_msid : Int64 | Array(Int64), sender_id : Int64 | Nil, receiver_ids : Array(Int64), reply_msids : Hash(Int64, ReplyParameters), func : MessageProc) : Nil #

Creates a new QueuedMessage and pushes it to the back of the queue.


[View source]
def enqueue_priority(receiver_id : Int64, reply : ReplyParameters | Nil, func : MessageProc) : Nil #

Creates a new QueuedMessage and pushes it to the front of the queue. Useful for reply messages.


[View source]
def get_message : QueuedMessage | Nil #

Returns the first QueuedMessage in the #queue if it is available

Returns nil if there is no QueuedMessage in the #queue


[View source]
def queue : Deque(QueuedMessage) #

A double-ended queue of QueuedMessage; enqueued user messages are sent to the back of the queue, while system messages are sent to the front.


[View source]
def queue_mutex : Mutex #

Provides mutually exclusion for elements in the queue. Assume that it is necessary when interacting with the queue.


[View source]
def reject_messages(&) : Nil #

Removes messsages from queue based on if the given block is truthy


[View source]