jiangphcn commented on issue #2666: soft-deletion for database
URL: https://github.com/apache/couchdb/pull/2666#issuecomment-608411228
 
 
   Thanks @davisp and @mikerhodes for your comments. Today I have one commit 
eefd115 which essentially implemented below API spec.
   
   ```
   GET /_deleted_dbs - List deleted dbs infos
   GET /_deleted_dbs?key=dbName - List specified deleted db infos
   POST /_deleted_dbs - Only accepts the undelete JSON body to *restore* the 
deleted db
   DELETE /_deleted_dbs/DbName?timestamp=2020-01-01T00:00:00 - Remove deleted db
   ```
   From the functional set exposed to users, I think that it is similar to what 
@mikerhodes drafted in [1]. The difference is the API spec. 
   
   From user case and implementation's point of view, there are several points 
I want to mention.
   1. GET /_deleted_dbs - List deleted dbs infos
   We directly return dbs info instead of the deleted dbname here. The same 
case is for `GET /_deleted_dbs?key=dbName`. This is mainly following the 
approach in `_dbs_info`. I think that most likely user is not only interested 
in dbname, but also in some detailed information about deleted database. 
   ```
     {
       "key": "db01",
       "timestamp": "2020-04-03T12:09:15Z",
       "value": {
         "update_seq": "000000000000000000000000",
         "doc_del_count": 0,
         "doc_count": 0,
         "sizes": {
           "external": 2,
           "views": 0
         }
       }
   ```
   User can gradually use the progressive approach like mentioned in [1] to get 
the detailed information of the deleted db.
   ```
   GET /_deleted_dbs
   GET /_deleted_dbs/DbName
   GET /_deleted_dbs/DbName/2020-01-01T00:00:00
   ```
   However, looks that user most like should review information of the deletion 
time, doc number, disk size to decide to restore it or permanently delete it.
   
   2. with regard to 
   ```
   GET /_deleted_dbs/DbName
   GET /_deleted_dbs?key=DbName
   ```
   In theory, we can implement both of them to get information of deleted db. 
@davisp also found one situation where we have to return 200 and [] if the 
specified db is not in deleted_db list when selecting `GET 
/_deleted_dbs/DbName`. This is not expected error code. So we switch to `GET 
/_deleted_dbs?key=DbName`.
   
   Hope this can give some explanation how we are getting to the current status 
of API spec.  
   
   [1] https://gist.github.com/mikerhodes/39c66576eee468a5aeaa23c5715aec9a
   
   
   

----------------------------------------------------------------
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

Reply via email to