p4p icon indicating copy to clipboard operation
p4p copied to clipboard

New methods for Handler and SharedPV

Open Monarda opened this issue 7 months ago • 1 comments

This is an attempt to simplify PR #155 so that it's simply about adding new methods (post, open, and close) to the Handler and SharedPV classes in p4p.server.raw.

example\persist.py shows what can be achieved with the new open and post methods. The example uses an SQLite database to persist the values of channels to a (database) file. When the program is restarted these values are read back and automatically restored to their original channels with their original timestamps. persist.py uses the post functionality to update the values of the PVs, automatically updating their timestamps, and persisting the changed values. It uses the open functionality to restore the values on restart. The use of the incrementing value shows a scenario in which it is more convenient to do this in the handler with the new methods (using the combination of open and post) and would not be as simple with existing methods such as onFirstConnect.

Monarda avatar May 27 '25 20:05 Monarda

Added some simple unit tests

Monarda avatar Aug 26 '25 12:08 Monarda