p2pfl.communication.protocols.client moduleΒΆ
Protocol agnostic client.
- class p2pfl.communication.protocols.client.Client[source]ΒΆ
Bases:
ABC
Client interface.
It is used as a interface to help to decoulple communication protocols based on clien-server architecutes.
Todo
Encapsulate msg.
- abstract build_message(cmd, args=None, round=None)[source]ΒΆ
Build a message to send to the neighbors.
- Parameters:
cmd (
str
) β Command of the message.args (
Optional
[List
[str
]]) β Arguments of the message.round (
Optional
[int
]) β Round of the message.
- Return type:
Any
- Returns:
Message to send.
- abstract build_weights(cmd, round, serialized_model, contributors=None, weight=1)[source]ΒΆ
Build a weight message to send to the neighbors.
- Parameters:
cmd (
str
) β Command of the message.round (
int
) β Round of the message.serialized_model (
bytes
) β Serialized model to send.contributors (
Optional
[List
[str
]]) β List of contributors.weight (
int
) β Weight of the message.
- Return type:
Any