Coordinator

Coordinator among channels.

ehforwarderbot.coordinator.profile

Name of current profile..

Type

str

ehforwarderbot.coordinator.mutex

Global interaction thread lock.

Type

threading.Lock

ehforwarderbot.coordinator.master

The running master channel object.

Type

Channel

ehforwarderbot.coordinator.slaves

Dictionary of running slave channel object. Keys are the unique identifier of the channel.

Type

Dict[str, EFBChannel]

ehforwarderbot.coordinator.middlewares

List of middlewares

Type

List[Middleware]

ehforwarderbot.coordinator.add_channel(channel)[source]

Register the channel with the coordinator.

Parameters

channel (Channel) – Channel to register

ehforwarderbot.coordinator.add_middleware(middleware)[source]

Register a middleware with the coordinator.

Parameters

middleware (Middleware) – Middleware to register

ehforwarderbot.coordinator.get_module_by_id(module_id)[source]

Return the module instance of a provided module ID

Parameters

module_id (NewType()(ModuleID, str)) – Module ID, with instance ID if available.

Return type

Union[Channel, Middleware]

Returns

Module instance requested.

Raises

NameError – When the module is not found.

ehforwarderbot.coordinator.master: ehforwarderbot.channel.MasterChannel

The instance of the master channel.

ehforwarderbot.coordinator.master_thread: Optional[threading.Thread] = None

The thread running poll() of the master channel.

ehforwarderbot.coordinator.middlewares: List[ehforwarderbot.middleware.Middleware] = []

Instances of middlewares. Sorted in the order of execution.

ehforwarderbot.coordinator.mutex: _thread.allocate_lock = <unlocked _thread.lock object>

Mutual exclusive lock for user interaction through CLI interface

ehforwarderbot.coordinator.profile: str = 'default'

Current running profile name

ehforwarderbot.coordinator.send_message(msg)[source]

Deliver a new message or edited message to the destination channel.

Parameters

msg (Message) – The message

Return type

Optional[Message]

Returns

The message processed and delivered by the destination channel, includes the updated message ID if sent to a slave channel. Returns None if the message is not sent.

ehforwarderbot.coordinator.send_status(status)[source]

Deliver a status to the destination channel.

Parameters

status (Status) – The status

ehforwarderbot.coordinator.slave_threads: Dict[ModuleID, threading.Thread] = {}

Threads running poll() from slave channels. Keys are the channel IDs.

ehforwarderbot.coordinator.slaves: Dict[ModuleID, ehforwarderbot.channel.SlaveChannel] = {}

Instances of slave channels. Keys are the channel IDs.

ehforwarderbot.coordinator.translator: gettext.NullTranslations = <gettext.NullTranslations object>

Internal GNU gettext translator.