Open asmodehn opened 8 years ago
More thinking about this topic :
We need to dive more into https://docs.python.org/3/library/asyncio-task.html It seems a coroutine (or mixing a future with a generator) could give us the functionality we need of a function that can be called once and return a value multiple times, at different intervals...
ROS has 3 was to communicate :
Other systems have a combination of these. (REST is services only, but often a DB back is added and provide a global-state, at least for the backend side, MQTT is topics only, and topics can be used to implement services, etc.)
It could be interesting for pyzmp to unify these concepts, ie. design one communication concept that can be used to implement all of them (since each seems to be a specialization of a more abstract/basic concept).
Services are very versatile to handle communication (discoverable, client needs no specific requirements, etc.), and are already implemented, so it make sense we use these as a base.
We need to add :
multiple response overtime -> the service then behaves as "setting up a hook". This has to be the generic way of using the service. Receiving only one response, or signaling that all responses later will be the same, is a special case. We probably need a future as a response, plus some queue manipulation to consume responses... Maybe also a way to inverse controlflow...
multiple request overtime -> a service can already do that by sending many requests, and not expecting any answer. But we need a way in code to express that we dont need any answer. So implementing async call should be enough.
global state -> a service should be used to maintain the visibility of a global state for the pyzmp multiple processes. likely implementing raft.