[tahoe-dev] Random access to files

zooko zooko at zooko.com
Wed Jan 28 16:03:23 UTC 2009


On Jan 27, 2009, at 6:59 AM, Shawn Willden wrote:

> It looks to me like the set of segments selected for download is  
> defined in the loop in _download_all_segments:
>
>         for segnum in range(self._vup.num_segments):
>             d.addCallback(self._download_segment, segnum)
>             # this pause, at the end of write, prevents pre-fetch from
>             # happening until the consumer is ready for more data.
>             d.addCallback(self._check_for_pause)
>         return d
>
> Is it really as simple as restricting the range of this for loop?

Yes.  Then of course we want to throw out parts of the segment that  
aren't in the requested range and just return the requested subset.

Also of course we need to keep in mind the fact that this is changing  
the CiphertextDownloader to be invoked multiple times with successive  
get_range() methods instead of a single start() method.  It isn't too  
complicated to make sure that any state which needs to be initialized  
exactly once is initialized exactly once.

Heh heh heh!  Now I see that Brian wrote a reply to your message  
saying that it is rather more complicated than this!  I'm not sure  
why his and my opinion differ -- no doubt I've overlooked some  
details that Brian has remembered -- but also I think Brian described  
a larger project which refactors this code more and adds more  
features.  I guess it is up to you to dive in and figure out just how  
hard it really is.  ;-)

Regards,

Zooko
---
Tahoe, the Least-Authority Filesystem -- http://allmydata.org
store your data: $10/month -- http://allmydata.com/?tracking=zsig



More information about the tahoe-dev mailing list