OpenCyphal / pycyphal

Python implementation of the Cyphal protocol stack.
https://pycyphal.readthedocs.io/
MIT License
117 stars 105 forks source link

Redesign the registry API #329

Open pavel-kirienko opened 3 months ago

pavel-kirienko commented 3 months ago

The current design is too complex, and there is a sensible way to simplify it without losing any important functionality. The simpler callback-based design worked well in embedded applications, and I think we should try it on PyCyphal. The segregation between the different backends needs to go, allowing the user to manually load-store the registers at node startup/shutdown as needed, while the Registry core remains merely a simple dict of callables.

The automatic creation of persistent registers needs to be reconsidered also to address https://github.com/OpenCyphal/pycyphal/issues/309.

We also need to support load/store to/from YAML, which is to be invoked manually by the application at the opportune time rather than implicitly; see #249. The Sqlite integration is not worth keeping.

Similarly to YAML, there may be a load backend that loads the register values from the command line arguments; the environment variable backend should perhaps be built in a similar way.