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

GRPC server.

class p2pfl.communication.protocols.protobuff.grpc.server.GrpcServer(gossiper, neighbors, commands=None)[source]ΒΆ

Bases: ProtobuffServer

Implementation of the server side logic of GRPC communication protocol.

Parameters:
  • addr – Address of the server.

  • gossiper (Gossiper) – Gossiper instance.

  • neighbors (Neighbors) – Neighbors instance.

  • commands (list[Command] | None) – List of commands to be executed by the server.

is_running()[source]ΒΆ

Check if the server is running.

Return type:

bool

Returns:

True if the server is running, False otherwise.

set_addr(addr)[source]ΒΆ

Parse and set the addr of the node.

Parameters:

addr (str)

Return type:

str

start(wait=False)[source]ΒΆ

Start the GRPC server.

Parameters:

wait (bool) – If True, wait for termination.

Return type:

None

stop()[source]ΒΆ

Stop the GRPC server.

Return type:

None

wait_for_termination()[source]ΒΆ

Wait for termination.

Return type:

None