Hi Jens, you seem like you're on the right track. pread_iolist determines the block length and binds it to the Len variable, so in principle you could add another couch_file function which just did that part but skipped the actual reading of the data:

block_length(Fd, Pos) ->
    {ok, LenIolist, NextPos} = read_raw_iolist(Fd, Pos, 4),
    <<_:1/integer, Len:31/integer>> = iolist_to_binary(LenIoList),
    Len.

Of course this would disable MD5 validation on the skipped bytes; I'm not sure if anyone has discussed the ramifications. Best,

Adam

On Oct 29, 2009, at 5:14 AM, [email protected] wrote:

Hi Jan,

I found some time to look into the code and I have a rough idea on how
this can be implemented. As far as I understand, an attachment is stored
in blocks and then contains data on where those blocks can be found on
disk. The actual length of the block is stored on disk. Therefore, the
attachment basically has a list of starting positions of the blocks. Only the lower level functions (such as pread_iolist) know the actual length of the blocks. Therefore, I will need to first determine the block lengths,
then determine which blocks fall into the requested range and finally
trigger the sending of those blocks. I could not find any way to get the
block lengths yet, so I will have to implement this. Am I on the right
track or do you think there is some other functionality in the current
implementation that I could use for this?

Thanks,
Jens





Jan Lehnardt <[email protected]>
27.10.2009 15:58
Please respond to
[email protected]


To
[email protected]
cc

Subject
Re: COUCHDB-161 Range Request support for attachments






Hi Jens,

http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_db.erl?view=markup


line 857 ff.

Cheers
Jan
--

On 27 Oct 2009, at 15:32, [email protected] wrote:

Hi Jan,

I didn't check out the sources yet, so I can't promise anything. But
if
you can point me to the right entry point in the code, I would
definitely
have a look.

Thanks,
Jens




Jan Lehnardt <[email protected]>
27.10.2009 15:22
Please respond to
[email protected]


To
[email protected]
cc

Subject
Re: COUCHDB-161 Range Request support for attachments







On 27 Oct 2009, at 15:10, [email protected] wrote:

Hi Jan,

Thanks for the quick reply. I googled for the release notes and
ended up
at:


http://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310780&styleName=Html&version=12313694


Guess that is just an automatic page generated from the Jira.
Anyway, are
there any plans to include this in the near future? I'm asking
because we
can work around this, but it would simplify our implementation if
this
feature is available.

I'd love to see it added too, but I don't know anyone who is currently
taking this on. The patch shouldn't be too hard and would be perfect
for a newcomer who is eager to dive into the CouchDB codebase.

I'd be happy to do some guiding.

Cheers
Jan
--




Thanks,
Jens




Jan Lehnardt <[email protected]>
27.10.2009 14:52
Please respond to
[email protected]


To
[email protected]
cc

Subject
Re: COUCHDB-161 Range Request support for attachments






Hi,

Range requests for attachments are not in 0.10. The release
notes don't include that information. I think the confusion stems
from that in JIRA, the issue is tagged 0.10. Note though that
the issue is still open.

Cheers
Jan
--

On 27 Oct 2009, at 14:38, [email protected] wrote:

Hi,

I saw that the release notes of 0.10 include the feature request
COUCHDB-161 "Range Request support for attachments". I tried using
the
http header "Range" when doing a normal Get request for an
attachment.
However, I always get the complete attachment. I configured the
CouchDb
log to output debug messages and it seems the header is received by
CouchDb. Is there anything else I need to do?

Thanks,
Jens

InterComponentWare AG:
Vorstand: Dr. Lutz Kleinholz (Vors.), Dr. Georg Ralle, Jörg
Stadler / Aufsichtsratsvors.: Prof. Dr. Christof Hettich
Firmensitz: 69190 Walldorf, Industriestraße 41 / AG Mannheim HRB
351761 / USt.-IdNr.: DE 198388516





InterComponentWare AG:
Vorstand: Dr. Lutz Kleinholz (Vors.), Dr. Georg Ralle, Jörg
Stadler / Aufsichtsratsvors.: Prof. Dr. Christof Hettich
Firmensitz: 69190 Walldorf, Industriestraße 41 / AG Mannheim HRB
351761 / USt.-IdNr.: DE 198388516




InterComponentWare AG:
Vorstand: Dr. Lutz Kleinholz (Vors.), Dr. Georg Ralle, Jörg
Stadler / Aufsichtsratsvors.: Prof. Dr. Christof Hettich
Firmensitz: 69190 Walldorf, Industriestraße 41 / AG Mannheim HRB
351761 / USt.-IdNr.: DE 198388516





InterComponentWare AG:
Vorstand: Dr. Lutz Kleinholz (Vors.), Dr. Georg Ralle, Jörg Stadler / Aufsichtsratsvors.: Prof. Dr. Christof Hettich Firmensitz: 69190 Walldorf, Industriestraße 41 / AG Mannheim HRB 351761 / USt.-IdNr.: DE 198388516

Reply via email to