p2pfl.communication.protocols.grpc.grpc_server moduleΒΆ
GRPC server.
- class p2pfl.communication.protocols.grpc.grpc_server.GrpcServer(addr, gossiper, neighbors, commands=None)[source]ΒΆ
Bases:
NodeServicesServicer
Implementation of the server side of a GRPC communication protocol.
- Parameters:
addr (
str
) β Address of the server.gossiper (
Gossiper
) β Gossiper instance.neighbors (
GrpcNeighbors
) β Neighbors instance.commands (
Optional
[List
[Command
]]) β List of commands to be executed by the server.
- disconnect(request, _)[source]ΒΆ
GRPC service. It is called when a node disconnects from another.
- Parameters:
request (
HandShakeRequest
) β Request message._ β Context.
- Return type:
Empty
- handshake(request, _)[source]ΒΆ
GRPC service. It is called when a node connects to another.
- Parameters:
request (
HandShakeRequest
) β Request message._ β Context.
- Return type:
ResponseMessage
- is_running()[source]ΒΆ
Check if the server is running.
- Return type:
bool
- Returns:
True if the server is running, False otherwise.
- send(request, _)[source]ΒΆ
GRPC service. Handles both regular messages and model weights.
- Parameters:
request (
RootMessage
) β The RootMessage containing either a Message or Weights payload._ β Context.
- Return type:
ResponseMessage