davisp commented on a change in pull request #2666: soft-deletion for database
URL: https://github.com/apache/couchdb/pull/2666#discussion_r400301844
##########
File path: src/chttpd/src/chttpd_misc.erl
##########
@@ -146,6 +147,143 @@ handle_all_dbs_req(#httpd{method='GET'}=Req) ->
handle_all_dbs_req(Req) ->
send_method_not_allowed(Req, "GET,HEAD").
+handle_deleted_dbs_req(#httpd{path_parts=[<<"_deleted_dbs">>]}=Req) ->
Review comment:
The combination of function names here is a bit difficult. I'd change this
around to move function implementations to this top level function. Something
like:
```erlang
handle_deleted_dbs_req(#httpd{method = 'GET', path_parts = [_]}) ->
... body of deleted_dbs_req with method='GET' ...;
handle_deleted_dbs_req(#httpd{method = 'GET', path_parts = [_, DbName]) ->
... body of deleted_dbs_info_req ...;
handle_deleted_dbs_req(#httpd{method = 'POST', path_parts = [_]}) ->
... body of deleted_dbs_post_req ...;
handle_deleted_dbs_req(#httpd{path_parts = PP}) when length(PP) =< 2 ->
send_method_not_allowed("GET,HEAD,POST");
handle_deleted_dbs_req(Req) ->
chttpd:send_error({error, not_found}).
```
And to be clear, I'd leave handle_undelete/delete_deleted as separate
functions (though rename delete_deleted to remove_deleted or similar to match
fabric2_db API names.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services