|02-18-2011, 06:23 PM||#1|
Join Date: Oct 2010
Location: London, UK
Device: Kindle Paperwhite 3G, iPad 3, iPad Air
database2.py deletion notifications
Is the notify=True argument on the majority of functions in database2.py historical code, for future usage, or just selectively used?
I wanted to get notifications about rows being deleted in my plugin so that I could update some id mapping caches I maintain. However I see that while all the infrastructure is there, the call to delete_book sets notify=False. Further searches revealed only one call to add_event_listener in the codebase, and that was in tag_viewer.py which responded to any notification it might receive.
In the end I chose an approach of db.data.has_id() when I retrieve an id from my cache to verify it is still valid and remove it if not. Anything else I could/should have done instead?
|02-18-2011, 06:27 PM||#2|
creator of calibre
Join Date: Oct 2006
Location: Mumbai, India
IIRC it's used in a couple of places. It was originally going to be much more comprehensively used, but there turned out to be not much need for it.
Historically the in memory cache was not nearly as comprehensive as it is now, and so querying for existence was much more costly than it is now.
|02-18-2011, 06:45 PM||#4|
"chaley", not "charley"
Join Date: Jan 2010
Device: PRS-300, Galaxy Nexus, Nexus 7, HTC Sensation, Galaxy Tab 10.1
We might consider a publish and subscribe interface on db.data, calling the supplied subscription method whenever the cache changes. An interface at the cache level would be lower-level than the current notifier and possibly more accurate, signaling deletions, additions, and replacements. However, I don't think we should do this until (if and when) we have more cases where it would be used, because changing the interface after it is used would be a genuine bother.
|Thread Tools||Search this Thread|
|Thread||Thread Starter||Forum||Replies||Last Post|
|Wireless (email) delivery and automatic deletion?||kidblue||Calibre||7||10-08-2010 12:11 PM|
|Multi-select pages for deletion?||neonbible||Sigil||3||09-09-2010 10:37 PM|
|Daily notifications?||devilsadvocate||Feedback||8||01-22-2010 01:24 PM|
|Format deletion||jbjb||Calibre||8||11-29-2008 01:18 PM|
|Ereader.com account deletion||jadedboi||Reading and Management||1||06-07-2006 03:13 PM|