1. Connector Interface
1.1. Interface Definition for Connectors, CChannels and Flasher
- module:
connector
- synopsis:
Interface for a channel
- class pykiso.connector.CChannel(processing=False, **kwargs)[source]
Abstract class for coordination channel.
Constructor.
- Parameters:
processing – deprecated, will not be taken into account.
- abstract _cc_receive(timeout, **kwargs)[source]
How to receive something from the channel.
- Parameters:
timeout (
float
) – Time to wait in second for a message to be receivedkwargs – named arguments
- Return type:
Dict
[str
,Optional
[bytes
]]- Returns:
dictionary containing the received bytes if successful, otherwise None
- abstract _cc_send(msg, **kwargs)[source]
Sends the message on the channel.
- Parameters:
msg (
Union
[Message
,bytes
,str
]) – Message to send outkwargs – named arguments
- Return type:
None
- cc_receive(timeout=0.1, *args, **kwargs)[source]
Read a thread-safe message on the channel and send an acknowledgement.
- Parameters:
timeout (
float
) – time in second to wait for reading a messagekwargs – named arguments
- Return type:
Dict
[str
,Optional
[bytes
]]- Returns:
the received message
- class pykiso.connector.Connector(name=None)[source]
Abstract interface for all connectors to inherit from.
Defines hooks for opening and closing the connector and also defines a contextmanager interface.
Constructor.
- Parameters:
name (
str
) – alias for the connector, used forrepr
and logging.