Story #3411
closed[API] Implement Trash behavior using collection expiration
100%
Description
A collection can have two different kinds of permanence: ephemeral or persisted.
When a user creates a collection, they will need to specify which kind permanence they want.
Each collection has an expiration date but persisted collections have an expiration date of "never" or null or however it's easiest to represent.
There should be a systemwide setting for "ephemeral lifetime" and it should be set to two weeks by default. Changing this value to less than 24 hours should result in an error. The api server should return this value to callers when requested, because the data manager will need to know it before deleting blocks.
When a collection is created as ephemeral, its expiration date should be set to now + "ephemeral lifetime". Likewise, if a collection's permanence is switched from to ephemeral, its expiration date should be set to now + "ephemeral lifetime".
When the api server returns collections for any request, it should only return collections whose expiration date is in the future or never. The api server should support a flag in requests that will enable it to also return expired collections.
For more information on Ephemeral Collections, see:
https://arvados.org/projects/orvos-private/wiki/Keep_Design_Doc#Persisting-Data
Implementation notes
First branch:API server collections table column:delete_at
(default is null)expires_at
column got added in #3036- API server configuration setting:
default_trash_lifetime
- API server discovery document entry:
defaultTrashLifetime
- API server implicitly selects
expires_at is null or expires_at > now
when querying collections table (rails "default scope" can do this)
- Workbench "trash" button on collections that sets
expires_at
tonow + default_trash_lifetime
(default retrieved in discovery document). - Workbench "trash" tab in project view that shows trashed collections (with "un-trash" button)
See also #3150