p2pfl.communication.protocols.memory.memory_server moduleΒΆ
In-memory server.
- class p2pfl.communication.protocols.memory.memory_server.InMemoryServer(addr, gossiper, neighbors, commands=None)[source]ΒΆ
Bases:
object
Implementation of the server side of an in-memory communication protocol.
- Parameters:
addr (
str
) β Address of the server.gossiper (
Gossiper
) β Gossiper instance.neighbors (
InMemoryNeighbors
) β Neighbors instance.commands (
Optional
[List
[Command
]]) β List of commands to be executed by the server.
- disconnect(request)[source]ΒΆ
In-memory service. It is called when a node disconnects from another.
- Parameters:
request (
Dict
[str
,Any
]) β Request message.- Return type:
None
- handshake(request)[source]ΒΆ
In-memory service. It is called when a node connects to another.
- Parameters:
request (
Dict
[str
,Any
]) β Request message.- Return type:
Dict
[str
,Any
]
- is_running()[source]ΒΆ
Check if the server is running.
- Return type:
bool
- Returns:
True if the server is running, False otherwise.
- send_message(request)[source]ΒΆ
In-memory service. It is called when a node sends a message to another.
- Parameters:
request (
Dict
[str
,Any
]) β Request message- Return type:
Dict
[str
,Any
]
- send_weights(request)[source]ΒΆ
In-memory service. It is called when a node sends weights to another.
- Parameters:
request (
Dict
[str
,Any
]) β Request message.- Return type:
Dict
[str
,Any
]