-
- Downloads
Revise network communication backend and message-parsing logic.
- Introduce a new 'declearn.communication.api.backend' submodule: - Introduce a new 'ActionMessage' minimal backend API, that defines hard-coded, lightweight and easily-parsed data structures designed to convey information and content across network communications agnostic to the content's nature. - Move 'declearn.communication.messaging.flags' submodule to 'declearn.communication.api.backend.flags'. - Move 'MessagesHandler' semi-private class to the 'backend' submodule, where it is now properly exposed. - Revise 'MessagesHandler': - Have it use the new 'ActionMessage's to wrap up messages, and delay their content's parsing to other times and parts of the code. - Quit sending information together with registration requests. In the future, we may want to introduce some callback system to validate or complete a registration request's processing. - Turn 'heartbeat' into an instantiation parameter. - Revise 'NetworkClient' and 'NetworkServer': - Quit passing of 'data_info' with registration requests. - Have message-sending and message-receiving methods expect str inputs and return str outputs: the actual parsing into objects is therefore delayed and left to be defined elsewhere. - Rename 'NetworkClient.check_message' into 'recv_message' (keep the former as an alias, with a DeprecationWarning). - Improve the use of (optional) timeouts when sending or expecting messages and overall exceptions handling: - 'NetworkClient.recv_message' may either raise a TimeoutError (in case of timeout) or RuntimeError (in case of rejection). - 'NeworkServer.send_messages' and 'broadcast_message' quietly stops waiting for clients to collect messages after the (opt.) timeout delay has passed. Messages may still be collected. - 'NetworkServer.wait_for_messages' no longer accepts a timeout. - 'NetworkServer.wait_for_messages_with_timeout' implements the possibility to setup a timeout. It returns both received client replies and a list of clients that failed to answer.
Showing
- declearn/communication/api/_client.py 154 additions, 80 deletionsdeclearn/communication/api/_client.py
- declearn/communication/api/_server.py 85 additions, 90 deletionsdeclearn/communication/api/_server.py
- declearn/communication/api/backend/__init__.py 47 additions, 0 deletionsdeclearn/communication/api/backend/__init__.py
- declearn/communication/api/backend/_handler.py 150 additions, 149 deletionsdeclearn/communication/api/backend/_handler.py
- declearn/communication/api/backend/actions.py 144 additions, 0 deletionsdeclearn/communication/api/backend/actions.py
- declearn/communication/api/backend/flags.py 13 additions, 11 deletionsdeclearn/communication/api/backend/flags.py
- declearn/communication/grpc/_client.py 8 additions, 12 deletionsdeclearn/communication/grpc/_client.py
- declearn/communication/grpc/_server.py 1 addition, 1 deletiondeclearn/communication/grpc/_server.py
- declearn/communication/messaging/__init__.py 0 additions, 4 deletionsdeclearn/communication/messaging/__init__.py
- declearn/communication/websockets/_client.py 5 additions, 8 deletionsdeclearn/communication/websockets/_client.py
Loading
Please register or sign in to comment