On 16.02.2011 13:06, Daniel Shahaf wrote: > Julian Foad wrote on Tue, Feb 15, 2011 at 15:06:43 +0000: >> * * This specification is conceptually simple, but requires completing disk >> * operations within SDB transactions, which may make it too inefficient >> * in practice. An alternative specification could use the Work Queue to >> * enable more efficient processing of multiple transactions. >> * > I won't call it simple unless you dereference that "Ensure" I mentioned > earlier :). > > For example, would returning a pristine stream to a caller would require > some long-living state on the DB handle, to avoid it being prematurely > deleted?
A handle to a pristine file constitutes a reference. Therefore, you can do one of two things: * Do proper reference counting in the WC when you open pristine files. This is for all practical purposes impossible to implement without hijacking the whole VFS. * Impose constraints on what users of the file handle can expect, for example: o you are not allowed write access through the file (pristine file creation is a magical step) o you cannot assume that you will find the file that the handle refers to in any directory listing o you cannot assume that the file will continue to exist after the handle is closed That last assumes that once can delete a file that still has open file handles. That always works on Unix, and can work on Windows when the file is opend with the FILE_SHARE_DELETE flag set (the difference between Ux and Win is that the file will vanish from the directory immediately upon delete, whilst on Windows, it'll vanish when the last handle is closed). All in all, letting the OS maintain open-handle reference counts is much better than trying to fake it through sqlite. -- Brane