You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2020/04/28 11:57:17 UTC

[couchdb] branch prototype/fdb-layer updated: Remove etag from changes and _list_dbs

This is an automated email from the ASF dual-hosted git repository.

garren pushed a commit to branch prototype/fdb-layer
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/prototype/fdb-layer by this push:
     new 19d8582  Remove etag from changes and _list_dbs
19d8582 is described below

commit 19d8582ef708d18408d1fde176d43602140b65ba
Author: Garren Smith <ga...@gmail.com>
AuthorDate: Tue Apr 28 10:22:58 2020 +0200

    Remove etag from changes and _list_dbs
---
 src/chttpd/src/chttpd_db.erl   | 22 ++++++++--------------
 src/chttpd/src/chttpd_misc.erl | 19 +++++--------------
 2 files changed, 13 insertions(+), 28 deletions(-)

diff --git a/src/chttpd/src/chttpd_db.erl b/src/chttpd/src/chttpd_db.erl
index 0780095..7cafabc 100644
--- a/src/chttpd/src/chttpd_db.erl
+++ b/src/chttpd/src/chttpd_db.erl
@@ -42,7 +42,6 @@
 
 % Accumulator for changes_callback function
 -record(cacc, {
-    etag,
     feed,
     mochi,
     prepend = "",
@@ -103,16 +102,12 @@ handle_changes_req_tx(#httpd{}=Req, Db) ->
     Max = chttpd:chunked_response_buffer_size(),
     case ChangesArgs#changes_args.feed of
     "normal" ->
-        Etag = <<"foo">>,
-        chttpd:etag_respond(Req, Etag, fun() ->
-            Acc0 = #cacc{
-                feed = normal,
-                etag = Etag,
-                mochi = Req,
-                threshold = Max
-            },
-            ChangesFun({fun changes_callback/2, Acc0})
-        end);
+        Acc0 = #cacc{
+            feed = normal,
+            mochi = Req,
+            threshold = Max
+        },
+        ChangesFun({fun changes_callback/2, Acc0});
     Feed when Feed =:= "continuous"; Feed =:= "longpoll"; Feed =:= "eventsource"  ->
         couch_stats:increment_counter([couchdb, httpd, clients_requesting_changes]),
         Acc0 = #cacc{
@@ -183,10 +178,9 @@ changes_callback({stop, _EndSeq}, #cacc{feed = eventsource} = Acc) ->
 
 % callbacks for longpoll and normal (single JSON Object)
 changes_callback(start, #cacc{feed = normal} = Acc) ->
-    #cacc{etag = Etag, mochi = Req} = Acc,
+    #cacc{mochi = Req} = Acc,
     FirstChunk = "{\"results\":[\n",
-    {ok, Resp} = chttpd:start_delayed_json_response(Req, 200,
-        [{"ETag",Etag}], FirstChunk),
+    {ok, Resp} = chttpd:start_delayed_json_response(Req, 200, [], FirstChunk),
     {ok, Acc#cacc{mochi = Resp, responding = true}};
 changes_callback(start, Acc) ->
     #cacc{mochi = Req} = Acc,
diff --git a/src/chttpd/src/chttpd_misc.erl b/src/chttpd/src/chttpd_misc.erl
index 843c3fe..565b121 100644
--- a/src/chttpd/src/chttpd_misc.erl
+++ b/src/chttpd/src/chttpd_misc.erl
@@ -130,20 +130,11 @@ handle_all_dbs_req(#httpd{method='GET'}=Req) ->
         {skip, Skip}
     ],
 
-    % Eventually the Etag for this request will be derived
-    % from the \xFFmetadataVersion key in fdb
-    Etag = <<"foo">>,
-
-    {ok, Resp} = chttpd:etag_respond(Req, Etag, fun() ->
-        {ok, Resp} = chttpd:start_delayed_json_response(Req, 200, [{"ETag",Etag}]),
-        Callback = fun all_dbs_callback/2,
-        Acc = #vacc{req=Req,resp=Resp},
-        fabric2_db:list_dbs(Callback, Acc, Options)
-    end),
-    case is_record(Resp, vacc) of
-        true -> {ok, Resp#vacc.resp};
-        _ -> {ok, Resp}
-    end;
+    {ok, Resp} = chttpd:start_delayed_json_response(Req, 200, []),
+    Callback = fun all_dbs_callback/2,
+    Acc = #vacc{req=Req,resp=Resp},
+    {ok, Acc1} = fabric2_db:list_dbs(Callback, Acc, Options),
+    {ok, Acc1#vacc.resp};
 handle_all_dbs_req(Req) ->
     send_method_not_allowed(Req, "GET,HEAD").