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

EFBChannel

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[EFBMiddleware]

ehforwarderbot.coordinator.add_channel(channel: ehforwarderbot.channel.EFBChannel)[source]

Register the channel with the coordinator.

Parameters

channel (EFBChannel) – Channel to register

ehforwarderbot.coordinator.add_middleware(middleware: ehforwarderbot.middleware.EFBMiddleware)[source]

Register a middleware with the coordinator.

Parameters

middleware (EFBMiddleware) – Middleware to register

ehforwarderbot.coordinator.get_module_by_id(module_id: str) → Union[ehforwarderbot.channel.EFBChannel, ehforwarderbot.middleware.EFBMiddleware][source]

Return the module instance of a provided module ID :param module_id: Module ID, with instance ID if available.

Returns

Module instance requested.

Raises

NameError – When the module is not found.

ehforwarderbot.coordinator.master_thread = None

The thread running poll() of the master channel.

ehforwarderbot.coordinator.middlewares = []

Instances of middlewares. Sorted in the order of execution.

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

Mutual exclusive lock for user interaction through CLI interface

ehforwarderbot.coordinator.profile = 'default'

Current running profile name

ehforwarderbot.coordinator.send_message(msg: EFBMsg) → Optional[EFBMsg][source]

Deliver a message to the destination channel.

Parameters

msg (EFBMsg) – The message

Returns

The message sent by the destination channel, includes the updated message ID from there. Returns None if the message is not sent.

ehforwarderbot.coordinator.send_status(status: EFBStatus)[source]

Deliver a message to the destination channel.

Parameters

status (EFBStatus) – The status

ehforwarderbot.coordinator.slave_threads = {}

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

ehforwarderbot.coordinator.slaves = {}

Instances of slave channels. Keys are the channel IDs.

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

Internal GNU gettext translator.