davisp commented on a change in pull request #2666: soft-deletion for database
URL: https://github.com/apache/couchdb/pull/2666#discussion_r402437795
##########
File path: src/fabric/src/fabric2_db.erl
##########
@@ -204,12 +211,37 @@ delete(DbName, Options) ->
% Delete doesn't check user_ctx, that's done at the HTTP API level
% here we just care to get the `database_does_not_exist` error thrown
Options1 = lists:keystore(user_ctx, 1, Options, ?ADMIN_CTX),
- {ok, Db} = open(DbName, Options1),
- Resp = fabric2_fdb:transactional(Db, fun(TxDb) ->
- fabric2_fdb:delete(TxDb)
+ case lists:keyfind(deleted_at, 1, Options1) of
+ {deleted_at, TimeStamp} ->
+ fabric2_fdb:transactional(DbName, Options1, fun(TxDb) ->
+ fabric2_fdb:remove_deleted_db(TxDb, TimeStamp)
+ end);
+ false ->
+ {ok, Db} = open(DbName, Options1),
+ Resp = fabric2_fdb:transactional(Db, fun(TxDb) ->
+ fabric2_fdb:delete(TxDb)
+ end),
+ if Resp /= ok -> Resp; true ->
+ fabric2_server:remove(DbName)
+ end
+ end.
+
+
+deleted_dbs_info(DbName, Options) ->
Review comment:
This should be moved to after list_dbs_info so that it matches the order in
the exports list.
----------------------------------------------------------------
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