[Development] QFile: writing via a temporary file

Oswald Buddenhagen oswald.buddenhagen at nokia.com
Tue Jan 10 18:21:57 CET 2012


On Tue, Jan 10, 2012 at 02:08:38PM +0100, João Abecasis wrote:
> On 10. jan. 2012, at 13.31, ext Oswald Buddenhagen wrote:
> > On Tue, Jan 10, 2012 at 01:00:42PM +0100, ext João Abecasis wrote:
> >> It is not appropriate to tag an atomically-replace-previous-version on
> >> to the close()
> > 
> > you don't provide any supporting evidence for that pov, though.
> 
> Because code that wasn't written to make use of the transactional
> functionality we're trying to offer could assume that close followed
> by open is a safe operation. There could be code that opens, writes,
> closes for each sub-component that goes in the file or something of
> that sort.
> 
we already determined that this use case is not applicable to this
feature. SafeSafe implies/depends on Truncate (which, btw, is implicit
in WriteOnly mode in qt).

> >>> No, whatever this class is, close() without commit() means
> >>> "rollback".
> >> 
> >> Right. Keep in mind we are not only saving the new version. We're also
> >> destroying a previously known good copy.
> > 
> > uhm, so? without the temp file, open() would already do that.
> 
> True, but if we are to offer atomic replace previous version I think
> we can do it properly. That means explicit commits because code has to
> be written to take advantage of this feature properly. It also means
> not assuming that arbitrary code magically gets better because of the
> Transactional flag on open.
> 
actually, code *does* "magically" get better if it already has the right
error checks in place (your problem if it doesn't). in either case, it
doesn't get worse.
for something even more transactional, see the subthread starting at
http://mail.kde.org/pipermail/kde-frameworks-devel/2011-October/000004.html
last paragraph. you should probably read the previous messages, too.



More information about the Development mailing list