[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Questions on the new KIO::FileJob API
From:       Vlad <vladc6 () yahoo ! com>
Date:       2008-07-27 19:58:00
Message-ID: 353785.66687.qm () web54409 ! mail ! yahoo ! com
[Download RAW message or body]

Hi,

--- On Sun, 7/27/08, Allan Sandfeld Jensen <kde@carewolf.com> wrote:
> > > No. A read can result in any number data() emits.
> For files
> > > it will usually be
> > > only one, but for streams it can be multiple.
> > 
> > Does FileJob::write() work the same way? In other
> words, do we have to
> > check whether bytes_written == the number of bytes
> sent, and if not, then
> > attempt again to write what is left over?
> > 
> No you don't have to try again. It does the retries
> internally

This difference between FileJob::read() and FileJob::write() gets confusing. I suggest _not_ \
explicitly giving assurance that everything will be written at once, even though most KIO \
slaves will retry internally. It won't hurt client apps to check whether everything was indeed \
written and to prepare to write the leftover again if needed.

This way, the behaviors of FileJob::read() and FileJob::write() remain consistent with each \
other and with POSIX read() and write(), which don't guarantee atomicity either (see \
write_all() in kdelibs/kioslave/file/file.cpp).

Thanks,
Vlad


      


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic