Re: GVFS + LibreOffice + WebDAV



On tis, 2012-12-04 at 08:52 -0500, Adam Tauno Williams wrote:

> I've no clue how GVFS handles it, but I've written that code before.
> 
> 1. Open file in write mode 
>   -> open scratch file, write mode, sparse
>   -> LOCK target
> 2. Perform all operations to scratch file
> 3. Close file 
>    -> flush the scratch file
There should not be any reason to flush it here, ideally you want the
temporary file to never even reach the disk unless needed.
>    -> PUT the contents of the scratch file
>    -> UNLOCK target
> 
> Depending on the platform / language it is more-or-less difficult.
> 
> Hmmm.... now I do wonder how GVFS does it.  The special ways in which
> GVFS' WebDAV backend sucks might be explained here;  it generally
> behaves as though it has no cache.

Yes, gvfs doesn't really have any caching layer for files, although some
of the backends do have caches for directory and file metadata (like the
ftp backend). I've long wanted to implement a layer that implements
writing to files locally and flushing on close, as well as one for
reading where we start streaming to a local file as need but then read
from the local copy, allowing things like seeks to work.

There are some issues with these caches, for instance the fact that
close() is extremely expensive and is the only place that report real
i/o error is suprising to many apps, and will break things like progress
dialogs. Or we could fake the upload making close fast, but that risks
data loss due to undetected errors. 

Also, there might be cases where you just want to stream an entire file
and it doesn't make sense to have a local copy. Maybe we could add some
flags that allow choosing what kind of behaviour you want.

Anyway, these things would be nice, but nobody is working on it atm.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]