You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2014/03/26 00:38:52 UTC
[2/2] chttpd commit: updated refs/heads/1993-bigcouch-couch-mrview to
5ba4717
Remove obsolete _list utility functions
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/5ba4717a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/5ba4717a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/5ba4717a
Branch: refs/heads/1993-bigcouch-couch-mrview
Commit: 5ba4717a7d436f42a476ac2cf6d0dcdad71147c1
Parents: 4cf1742
Author: Russell Branca <ch...@gmail.com>
Authored: Tue Mar 25 16:24:29 2014 -0700
Committer: Russell Branca <ch...@gmail.com>
Committed: Tue Mar 25 16:24:29 2014 -0700
----------------------------------------------------------------------
src/chttpd_show.erl | 85 ------------------------------------------------
1 file changed, 85 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/5ba4717a/src/chttpd_show.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_show.erl b/src/chttpd_show.erl
index 3c58d8e..d989e06 100644
--- a/src/chttpd_show.erl
+++ b/src/chttpd_show.erl
@@ -208,91 +208,6 @@ handle_view_list(Req, Db, DDoc, LName, {ViewDesignName, ViewName}, Keys) ->
end)
end).
-list_callback({meta, Meta}, #lacc{resp=nil} = Acc) ->
- MetaProps = case couch_util:get_value(total, Meta) of
- undefined -> [];
- Total -> [{total_rows, Total}]
- end ++ case couch_util:get_value(offset, Meta) of
- undefined -> [];
- Offset -> [{offset, Offset}]
- end ++ case couch_util:get_value(update_seq, Meta) of
- undefined -> [];
- UpdateSeq -> [{update_seq, UpdateSeq}]
- end,
- start_list_resp({MetaProps}, Acc);
-list_callback({meta, []}, Acc) ->
- % a sorted=false view where the message came in late. Ignore.
- {ok, Acc};
-list_callback({row, Row}, #lacc{resp=nil} = Acc) ->
- % first row of a reduce view, or a sorted=false view
- {ok, NewAcc} = start_list_resp({[]}, Acc),
- send_list_row(Row, NewAcc);
-list_callback({row, Row}, Acc) ->
- send_list_row(Row, Acc);
-list_callback(complete, Acc) ->
- #lacc{qserver = {Proc, _}, resp = Resp0} = Acc,
- if Resp0 =:= nil ->
- {ok, #lacc{resp = Resp}} = start_list_resp({[]}, Acc);
- true ->
- Resp = Resp0
- end,
- try couch_query_servers:proc_prompt(Proc, [<<"list_end">>]) of
- [<<"end">>, Chunk] ->
- {ok, Resp1} = send_non_empty_chunk(Resp, Chunk),
- chttpd:send_delayed_last_chunk(Resp1)
- catch Error ->
- {ok, Resp1} = chttpd:send_delayed_error(Resp, Error),
- {stop, Resp1}
- end;
-list_callback({error, Reason}, #lacc{resp=Resp}) ->
- chttpd:send_delayed_error(Resp, Reason).
-
-start_list_resp(Head, Acc) ->
- #lacc{
- req = Req,
- db = Db,
- qserver = QServer,
- lname = LName,
- etag = Etag
- } = Acc,
-
- % use a separate process because we're already in a receive loop, and
- % json_req_obj calls fabric:get_db_info()
- spawn_monitor(fun() -> exit(chttpd_external:json_req_obj(Req, Db)) end),
- receive {'DOWN', _, _, _, JsonReq} -> ok end,
-
- [<<"start">>,Chunk,JsonResp] = couch_query_servers:ddoc_proc_prompt(QServer,
- [<<"lists">>, LName], [Head, JsonReq]),
- JsonResp2 = apply_etag(JsonResp, Etag),
- #extern_resp_args{
- code = Code,
- ctype = CType,
- headers = ExtHeaders
- } = couch_httpd_external:parse_external_response(JsonResp2),
- JsonHeaders = couch_httpd_external:default_or_content_type(CType, ExtHeaders),
- {ok, Resp} = chttpd:start_delayed_chunked_response(Req, Code,
- JsonHeaders, Chunk),
- {ok, Acc#lacc{resp=Resp}}.
-
-send_list_row(Row, #lacc{qserver = {Proc, _}, resp = Resp} = Acc) ->
- try couch_query_servers:proc_prompt(Proc, [<<"list_row">>, {Row}]) of
- [<<"chunks">>, Chunk] ->
- {ok, Resp1} = send_non_empty_chunk(Resp, Chunk),
- {ok, Acc#lacc{resp=Resp1}};
- [<<"end">>, Chunk] ->
- {ok, Resp1} = send_non_empty_chunk(Resp, Chunk),
- {ok, Resp2} = chttpd:send_delayed_last_chunk(Resp1),
- {stop, Resp2}
- catch Error ->
- {ok, Resp1} = chttpd:send_delayed_error(Resp, Error),
- {stop, Resp1}
- end.
-
-send_non_empty_chunk(Resp, []) ->
- {ok, Resp};
-send_non_empty_chunk(Resp, Chunk) ->
- chttpd:send_delayed_chunk(Resp, Chunk).
-
% Maybe this is in the proplists API
% todo move to couch_util
json_apply_field(H, {L}) ->