[Sugar-devel] [PATCH Browse] Cancel a download if space is very tight SL #394

Martin Langhoff martin.langhoff at gmail.com
Mon Sep 10 18:13:09 EDT 2012


On Mon, Sep 10, 2012 at 6:02 PM, Manuel Kaufmann <humitos at gmail.com> wrote:
> On Mon, Sep 10, 2012 at 9:49 PM, Martin Langhoff
> <martin.langhoff at gmail.com> wrote:
>> Perhaps it is a stupid question but... in many HTTP requests you get
>> the size of the transfer in the HTTP headers, in the form of the
>> Content-Length header.
>
> I didn't follow this approach because of this comment:
> http://bugs.sugarlabs.org/ticket/394#comment:5

We address _that_ possibiliy (concurrent processes using up that disk
space) with the error handling I was proposing later in my comments.

So, putting that aside for a moment why a fixed guess is better than
the actual content-length?

It does make sense to declare a minimum buffer, but you have good
reliably info in content-length, use it!

>> And then, you need the most clear step: if the write fails, and the
>> error / exception tells you it's ENOSPC, you delete the object.
>
> Will Sugar recover immediately after getting ENOSPC and deleting the object?

Dunno. I hope so. Force the bug, see what you get. If things are
reasonably ok, you'll get an exception in the Sugar code, hopefully
the file is removed automatically from the Journal. So if all is good,
you are expected to handle the exception in Browse.

In terms of the Journal/datastore, you'd get the same situation
copying from a USB stick -- try a file that is too large to fit in the
free space you have...

cheers,



m
-- 
 martin.langhoff at gmail.com
 martin at laptop.org -- Software Architect - OLPC
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff


More information about the Sugar-devel mailing list