abstract class History

Direct Known Subclasses

Defined in:

privateparlor/history/history.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(message_life : Time::Span) #

[View source]

Instance Method Detail

def add_to_cache(origin_msid : Int64, msid : Int64, receiver_id : Int64) : Nil #

Adds receiver_id and its associated msid to an existing MessageGroup


[View source]
def del_message_group(msid : Int64) : Int64 #

Deletes a MessageGroup from #msid_map, including any msids that reference this MessageGroup

Returns the origin_msid of the given MessageGroup


[View source]
def expire : Nil #

Delete messages which have expired. Grabs MSIDs from MessageGroup receivers and deletes the messages from the history.


[View source]
def expired?(message : MessageGroup) : Bool #

Returns true if message is currently older than the given #lifespan.

Returns false otherwise.


[View source]
def get_all_msids(msid : Int64) : Hash #

Returns the receivers hash found in the associated MessageGroup


[View source]
def get_msid(msid : Int64, receiver_id : Int64) : Int64 | Nil #

Returns the receivers msid found in the associated MessageGroup


[View source]
def get_msids_from_user(uid : Int64) : Set(Int64) #

Retuns a set containing all msids sent by a given user.


[View source]
def get_origin_msid(msid : Int64) : Int64 | Nil #

Returns the original MSID of the associated MessageGroup


[View source]
def get_sender_id(msid : Int64) : Int64 | Nil #

Returns the sender of a specific MessageGroup


[View source]
def lifespan : Time::Span #

[View source]
def msid_map : Hash(Int64, MessageGroup) #

[View source]
abstract def new_message(sender_id : Int64, msid : Int64) : Int64 #

Creates a new MessageGroup with the sender_id and its associated msid

Returns the original msid of the new MessageGroup


[View source]