While working on Toggle Power/Input bugs, it really bacame apparent that we really need a way for individual modules to have persistant information across reloads of the DCE router. Toggle-command devices aren't the only thing that could benefit either - Lighting Plugin would benefit greatly as well especially for light switches that can't be polled for their status.
The only thing that makes sense to me is to have this functionallity locally coded for each module/plugin. This way, if persistant data is needed, you only have to add a bit of code to do it. If it is not needed, nothing needs changed.
Some Ideas that I had were:
1) Addition of a "Safe Reload" command. When this command is received, it sends out a "Safe Reload Received" event that each module/plugin could receive, and save whatever data they need. After a set amount of time, a normal relaod is carried out. Then, for example, after the reload is finished and the module is run, instead of initializing everything to 0, it can check for the existance of persistant data, and if it is less than 10 minutes old, use it - otherwize initialize to 0 as it does now. (this is just an example)
2) Instead of creating and implementing a new "Safe Reload" command, just modify the handling of the current reload to do as above: emit an event so other modules can clean up, then carry on with the reload. (Though the idea of a separate Safe Reload command appeals to me more.
3) Of course, it can be hacked in per module, saving values to a file when they change. But this is both messy and causes unnecessary disk usage.
4) A new PersistantData plugin where other plugins can register data to keep a local copy of, and restore them from the PersistantData plugin after reload (this would require that the PersistantData plugin be left alone during reload)
Anyone have some other suggestions or opinions we can kick around?