p2pfl.communication.protocols.protobuff.grpc.client moduleΒΆ

GRPC client.

class p2pfl.communication.protocols.protobuff.grpc.client.GrpcClient(self_addr, nei_addr)[source]ΒΆ

Bases: ProtobuffClient

Implementation of the client side (i.e. who initiates the communication) of the GRPC communication protocol.

Parameters:

self_addr (str) – Address of the node.

connect(handshake_msg=True)[source]ΒΆ

Connect to a neighbor.

Return type:

None

disconnect(disconnect_msg=True)[source]ΒΆ

Disconnect from a neighbor.

Return type:

None

is_connected()[source]ΒΆ

Check if a neighbor is connected.

Return type:

bool

Returns:

True if the neighbor is connected, False otherwise.

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