You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2015/08/25 18:59:42 UTC
chttpd commit: updated refs/heads/master to 129cdf9
Repository: couchdb-chttpd
Updated Branches:
refs/heads/master 932f1154f -> 129cdf934
Actually send an ETag for _view and _all_docs
We were previously sending ETag: undefined in both cases.
It would be better to not bother with Etag at all for these as the
odds of caching are low in a sharded system.
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/129cdf93
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/129cdf93
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/129cdf93
Branch: refs/heads/master
Commit: 129cdf934804169b705695d208878631397dcbf3
Parents: 932f115
Author: Robert Newson <rn...@apache.org>
Authored: Tue Aug 25 17:57:52 2015 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Tue Aug 25 17:58:44 2015 +0100
----------------------------------------------------------------------
src/chttpd_db.erl | 10 ++++------
src/chttpd_view.erl | 12 +++++-------
2 files changed, 9 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/129cdf93/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index a8fdc16..89e3a88 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -579,15 +579,13 @@ all_docs_view(Req, Db, Keys, OP) ->
Args1 = Args0#mrargs{view_type=map},
Args2 = couch_mrview_util:validate_args(Args1),
Args3 = set_namespace(OP, Args2),
- ETagFun = fun(Sig, Acc0) ->
- couch_mrview_http:check_view_etag(Sig, Acc0, Req)
- end,
- Args = Args3#mrargs{preflight_fun=ETagFun},
+ %% TODO: proper calculation of etag
+ Etag = [$", couch_uuids:new(), $"],
Options = [{user_ctx, Req#httpd.user_ctx}],
{ok, Resp} = couch_httpd:etag_maybe(Req, fun() ->
Max = chttpd:chunked_response_buffer_size(),
- VAcc0 = #vacc{db=Db, req=Req, threshold=Max},
- fabric:all_docs(Db, Options, fun couch_mrview_http:view_cb/2, VAcc0, Args)
+ VAcc0 = #vacc{db=Db, req=Req, threshold=Max, etag=Etag},
+ fabric:all_docs(Db, Options, fun couch_mrview_http:view_cb/2, VAcc0, Args3)
end),
case is_record(Resp, vacc) of
true -> {ok, Resp#vacc.resp};
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/129cdf93/src/chttpd_view.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_view.erl b/src/chttpd_view.erl
index ea1301c..a427eb1 100644
--- a/src/chttpd_view.erl
+++ b/src/chttpd_view.erl
@@ -31,7 +31,7 @@ multi_query_view(Req, Db, DDoc, ViewName, Queries) ->
Headers = [{"ETag", Etag}],
FirstChunk = "{\"results\":[",
{ok, Resp0} = chttpd:start_delayed_json_response(VAcc0#vacc.req, 200, Headers, FirstChunk),
- VAcc1 = VAcc0#vacc{resp=Resp0},
+ VAcc1 = VAcc0#vacc{resp=Resp0, etag=Etag},
VAcc2 = lists:foldl(fun(Args, Acc0) ->
{ok, Acc1} = fabric:query_view(Db, DDoc, ViewName, fun couch_mrview_http:view_cb/2, Acc0, Args),
Acc1
@@ -47,14 +47,12 @@ multi_query_view(Req, Db, DDoc, ViewName, Queries) ->
design_doc_view(Req, Db, DDoc, ViewName, Keys) ->
- Args0 = couch_mrview_http:parse_params(Req, Keys),
- ETagFun = fun(Sig, Acc0) ->
- couch_mrview_http:check_view_etag(Sig, Acc0, Req)
- end,
- Args = Args0#mrargs{preflight_fun=ETagFun},
+ Args = couch_mrview_http:parse_params(Req, Keys),
+ %% TODO: proper calculation of etag
+ Etag = [$", couch_uuids:new(), $"],
{ok, Resp} = couch_httpd:etag_maybe(Req, fun() ->
Max = chttpd:chunked_response_buffer_size(),
- VAcc0 = #vacc{db=Db, req=Req, threshold=Max},
+ VAcc0 = #vacc{db=Db, req=Req, threshold=Max, etag=Etag},
fabric:query_view(Db, DDoc, ViewName, fun couch_mrview_http:view_cb/2, VAcc0, Args)
end),
case is_record(Resp, vacc) of