Merge lp:~cmiller/desktopcouch/changes-notifications-to-clients into lp:desktopcouch
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Stuart Langridge | ||||
Approved revision: | not available | ||||
Merged at revision: | not available | ||||
Proposed branch: | lp:~cmiller/desktopcouch/changes-notifications-to-clients | ||||
Merge into: | lp:desktopcouch | ||||
Diff against target: |
184 lines (+148/-1) 2 files modified
desktopcouch/records/server_base.py (+74/-1) desktopcouch/records/tests/test_server.py (+74/-0) |
||||
To merge this branch: | bzr merge lp:~cmiller/desktopcouch/changes-notifications-to-clients | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stuart Langridge (community) | Approve | ||
Eric Casteleijn (community) | Approve | ||
Review via email: mp+14954@code.launchpad.net |
Commit message
Add CouchDatabase methods, 1) report_changes(cb), which calls a function for each of the db changes since the last time it was run or since the Database object was created. 2) get_changes() that returns a list of dictionaries with the changes. They does not recheck the database if the last time it was run is less than (a configurable) number of seconds ago. If there is an exception in the callback, then the event is not consumed, and the last-time-check is not updated.
'report_changes(f)' is not a call-this-
A common use of this might be to add calling this function when your main loop is idle, e.g., glib.mainloop.
Looks great and tests pass, thanks for adding get_changes!