p2pfl.communication.protocols.grpc.grpc_neighbors moduleΒΆ

gRPC neighbors.

class p2pfl.communication.protocols.grpc.grpc_neighbors.GrpcNeighbors(self_addr)[source]ΒΆ

Bases: Neighbors

Implementation of the neighbors for a GRPC communication protocol.

connect(addr, non_direct=False, handshake_msg=True)[source]ΒΆ

Connect to a neighbor.

Parameters:
  • addr (str) – Address of the neighbor to connect.

  • non_direct (bool) – If the connection is direct or not.

  • handshake_msg (bool) – If a handshake message is needed.

Return type:

Tuple[Optional[Channel], Optional[NodeServicesStub], float]

disconnect(addr, disconnect_msg=True)[source]ΒΆ

Disconnect from a neighbor.

Parameters:
  • addr (str) – Address of the neighbor to disconnect.

  • disconnect_msg (bool) – If a disconnect message is needed.

Return type:

None

refresh_or_add(addr, time)[source]ΒΆ

Refresh or add a neighbor.

Parameters:
  • addr (str) – Address of the neighbor.

  • time (float) – Time of the last heartbeat.

Return type:

None