summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_query_servers.erl
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2009-12-02 23:05:28 +0000
committerJohn Christopher Anderson <jchris@apache.org>2009-12-02 23:05:28 +0000
commit60a6b3e7ffa209da31d563beae33726412318957 (patch)
tree8daa0efe1941cf3b2b395af64ab96246e14876e4 /src/couchdb/couch_query_servers.erl
parentc32443a012dfe90d6872af829e8df9b743010c90 (diff)
removed add_fun optimization for filters, this provides better concurrency at the cost of some function transfer/eval overhead, which will be optimized in a future patch.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@886334 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_query_servers.erl')
-rw-r--r--src/couchdb/couch_query_servers.erl23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/couchdb/couch_query_servers.erl b/src/couchdb/couch_query_servers.erl
index 9ab4ff5a..4ac56727 100644
--- a/src/couchdb/couch_query_servers.erl
+++ b/src/couchdb/couch_query_servers.erl
@@ -20,7 +20,7 @@
-export([reduce/3, rereduce/3,validate_doc_update/5]).
-export([render_doc_show/6, render_doc_update/6, start_view_list/2,
render_list_head/4, render_list_row/4, render_list_tail/1]).
--export([start_filter/2, filter_doc/4, end_filter/1]).
+-export([filter_docs/5]).
% -export([test/0]).
-include("couch_db.hrl").
@@ -231,22 +231,15 @@ render_list_tail(Proc) ->
ok = ret_os_process(Proc),
JsonResp.
-start_filter(Lang, FilterSrc) ->
- Proc = get_os_process(Lang),
- true = proc_prompt(Proc, [<<"add_fun">>, FilterSrc]),
- {ok, Proc}.
-
-filter_doc(Proc, Doc, Req, Db) ->
+filter_docs(Lang, Src, Docs, Req, Db) ->
JsonReq = couch_httpd_external:json_req_obj(Req, Db),
- JsonDoc = couch_doc:to_json_obj(Doc, [revs]),
+ JsonDocs = [couch_doc:to_json_obj(Doc, [revs]) || Doc <- Docs],
JsonCtx = couch_util:json_user_ctx(Db),
- [true, [Pass]] = proc_prompt(Proc,
- [<<"filter">>, [JsonDoc], JsonReq, JsonCtx]),
- {ok, Pass}.
-
-end_filter(Proc) ->
- ok = ret_os_process(Proc).
-
+ Proc = get_os_process(Lang),
+ [true, Passes] = proc_prompt(Proc,
+ [<<"filter">>, Src, JsonDocs, JsonReq, JsonCtx]),
+ ret_os_process(Proc),
+ {ok, Passes}.
init([]) ->