#81 closed defect (fixed)

implement URI:LIT encoding for very small files

Reported by: warner Owned by: warner
Priority: critical Milestone: 0.5.0
Component: code Version: 0.4.0
Keywords: Cc:
Launchpad Bug:

Description

Uploading a zero-length file causes a divide-by-zero error, because segment_size ends up being zero.

It would probably be sufficient to simply make segment_size always be at least one.

Change History (5)

comment:1 Changed at 2007-07-11T22:31:43Z by warner

  • Priority changed from major to critical

upgrading priority because I really want this one fixed before the 0.5.0 release. Once the new webapi is in place and it is easy to upload a lot of files at once, this bug becomes a lot more annoying.

comment:2 Changed at 2007-07-12T17:58:53Z by warner

  • Summary changed from uploading an empty file causes an exception to implement URI:LIT encoding for very small files

we're going to fix this one by implementing URI:LIT uris, which are used for very small files (less than about 40 bytes), in which the entire file contents are contained verbatim inside the URI itself.

comment:3 Changed at 2007-07-12T19:31:46Z by warner

  • Owner changed from somebody to warner
  • Status changed from new to assigned

Our target for CHK URIs is URI:CHK:(base32(16byte AES key)):(base32(32byte URI Extension Hash)):needed_shares:total_shares:size

so that's 3+1+3+1+26+1+52+1+2+1+3+1+2 = 97 bytes (at least for <100B files).

Our plan for LIT uris is: URI:LIT:(base32(data))

So the breakeven point is 55 bytes. A 55 byte file will fit into a 3+1+3+1+88 = 96 byte LIT uri.

So if the file is 55 bytes or smaller, store it in a LIT, otherwise store it in the grid.

comment:4 Changed at 2007-07-12T19:32:49Z by warner

Oh, and of course this also includes 0-byte files, which neatly fixes the problem of the encoding algorithm exploding when faced with 0-byte files.

comment:5 Changed at 2007-07-12T20:25:39Z by warner

  • Resolution set to fixed
  • Status changed from assigned to closed

done, plus tests.

Note: See TracTickets for help on using tickets.