p2pfl.communication.protocols.protobuff.client moduleΒΆ
Protocol agnostic client.
- class p2pfl.communication.protocols.protobuff.client.ProtobuffClient(self_addr, nei_addr)[source]ΒΆ
Bases:
ABC
Client interface.
It is used as a interface to help to decoulple communication protocols based on clien-server architecutes.
- has_temporal_connection()[source]ΒΆ
Check if the client has a temporal connection.
- Return type:
bool
- Returns:
True if the client has a temporal connection, False otherwise.
- abstract is_connected()[source]ΒΆ
Check if a neighbor is connected.
- Return type:
bool
- Returns:
True if the neighbor is connected, False otherwise.
- log_successful_send(msg)[source]ΒΆ
Log a successful message sending.
- Parameters:
msg (
RootMessage
) β The message that was sent.- Return type:
None
- abstract send(msg, temporal_connection=False, raise_error=False, disconnect_on_error=True)[source]ΒΆ
Send a message to the neighbor.
- Parameters:
msg (
RootMessage
) β Message to send.temporal_connection (
bool
) β If the connection isnβt stablished and a temporal connection is needed for sending the message.raise_error (
bool
) β Raise error if an error occurs.disconnect_on_error (
bool
) β Disconnect if an error occurs.
- Return type:
None