couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r953499 - in /couchdb/trunk/src/couchdb: couch_doc.erl couch_httpd.erl
Date Thu, 10 Jun 2010 23:35:02 GMT
Author: damien
Date: Thu Jun 10 23:35:01 2010
New Revision: 953499

URL: http://svn.apache.org/viewvc?rev=953499&view=rev
Log:
Code mods to support streaming attachment replication.

Modified:
    couchdb/trunk/src/couchdb/couch_doc.erl
    couchdb/trunk/src/couchdb/couch_httpd.erl

Modified: couchdb/trunk/src/couchdb/couch_doc.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_doc.erl?rev=953499&r1=953498&r2=953499&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_doc.erl (original)
+++ couchdb/trunk/src/couchdb/couch_doc.erl Thu Jun 10 23:35:01 2010
@@ -308,7 +308,9 @@ att_foldl(#att{data=DataFun,att_len=Len}
    fold_streamed_data(DataFun, Len, Fun, Acc).
 
 att_foldl_decode(#att{data={Fd,Sp},md5=Md5,encoding=Enc}, Fun, Acc) ->
-    couch_stream:foldl_decode(Fd, Sp, Md5, Enc, Fun, Acc).
+    couch_stream:foldl_decode(Fd, Sp, Md5, Enc, Fun, Acc);
+att_foldl_decode(#att{data=Fun,att_len=Len, encoding=identity}, Fun, Acc) ->
+       fold_streamed_data(Fun, Len, Fun, Acc).
 
 att_to_bin(#att{data=Bin}) when is_binary(Bin) ->
     Bin;

Modified: couchdb/trunk/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd.erl?rev=953499&r1=953498&r2=953499&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd.erl Thu Jun 10 23:35:01 2010
@@ -799,6 +799,11 @@ read_until(#mp{data_fun=DataFun, buffer=
         {Buffer2, DataFun2} = DataFun(),
         Buffer3 = iolist_to_binary(Buffer2),
         read_until(Mp#mp{data_fun=DataFun2,buffer=Buffer3}, Pattern, Callback2);
+    {partial, 0} ->
+        {NewData, DataFun2} = DataFun(),
+        read_until(Mp#mp{data_fun=DataFun2,
+                buffer= iolist_to_binary([Buffer,NewData])},
+                Pattern, Callback);
     {partial, Skip} ->
         <<DataChunk:Skip/binary, Rest/binary>> = Buffer,
         Callback2 = Callback(DataChunk),
@@ -806,6 +811,10 @@ read_until(#mp{data_fun=DataFun, buffer=
         read_until(Mp#mp{data_fun=DataFun2,
                 buffer= iolist_to_binary([Rest | NewData])},
                 Pattern, Callback2);
+    {exact, 0} ->
+        PatternLen = size(Pattern),
+        <<_:PatternLen/binary, Rest/binary>> = Buffer,
+        {Mp#mp{buffer= Rest}, Callback};
     {exact, Skip} ->
         PatternLen = size(Pattern),
         <<DataChunk:Skip/binary, _:PatternLen/binary, Rest/binary>> = Buffer,



Mime
View raw message