chatflock.backing_stores.in_memory

Module Contents

class chatflock.backing_stores.in_memory.InMemoryChatDataBackingStore(messages=None, participants=None)

Bases: chatflock.base.ChatDataBackingStore

Helper class that provides a standard way to create an ABC using inheritance.

Parameters:
messages: List[chatflock.base.ChatMessage]
participants: Dict[str, chatflock.base.ChatParticipant]
last_message_id: int | None = None
get_messages()
Return type:

List[chatflock.base.ChatMessage]

add_message(sender_name, content, timestamp=None)
Parameters:
Return type:

chatflock.base.ChatMessage

clear_messages()
get_active_participants()
Return type:

List[chatflock.base.ActiveChatParticipant]

get_non_active_participants()
Return type:

List[chatflock.base.ChatParticipant]

get_active_participant_by_name(name)
Parameters:

name (str)

Return type:

Optional[chatflock.base.ActiveChatParticipant]

get_non_active_participant_by_name(name)
Parameters:

name (str)

Return type:

Optional[chatflock.base.ChatParticipant]

add_participant(participant)
Parameters:

participant (chatflock.base.ChatParticipant)

Return type:

None

remove_participant(participant)
Parameters:

participant (chatflock.base.ChatParticipant)

Return type:

None

has_active_participant_with_name(participant_name)
Parameters:

participant_name (str)

Return type:

bool

has_non_active_participant_with_name(participant_name)
Parameters:

participant_name (str)

Return type:

bool