View Single Post
Old 06-21-2011, 10:55 PM   #1
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,857
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Behavior changes

I've started work on a new, multi-threaded (among many other new features) database backend for calibre. Part of making that happen is ensuring that all file I/O on files in the library happens in the database class, so that it can protect the I/O appropriately.

I've committed changes to the format() and cover() functions in the current db class to make that happen. Basically, these functions used to originally pass back references to the files in the library. Now they copy the file to a temp file and pass back a reference to it, instead.

These changes have obvious performance implications, since they mean that every file has to be copied, so review your code to ensure that the changes don't have serious ill effects. In many cases, by using a different code structure, the performance impact can be mitigated.

Also, the format_abspath function has been deprecated and will no longer work reliably in the future, so if your code uses it, change the code to use format(..., as_path=True) instead (this is only available in current source).

I've already made the necessary changes to all the code in the calibre source tree, so this is really a heads up for plugin developers.

feel free to ask if you have any questions.
kovidgoyal is offline   Reply With Quote