Store generated links in MongoDB, along with expiry datetime.

Links are only regenerated after they have expired. For backward
compatibility the links are also generated when there is no expiry
or link. Every file has only one expiry timestamp for all its links.

In the future we might want to inspect the used projection, to see
whether the client needs those links at all (prevents unnecessary
regeneration), and to force inclusion of the expiry timestamp when
links are requested.
This commit is contained in:
2016-03-21 15:17:09 +01:00
parent 8d9a23b7b9
commit 37037f3c2c
5 changed files with 90 additions and 28 deletions

View File

@@ -413,6 +413,12 @@ files_schema = {
#'required': True,
'unique': True,
},
'link': {
'type': 'string',
},
'link_expires': {
'type': 'datetime',
},
'project': {
# The project node the files belongs to (does not matter if it is
# attached to an asset or something else). We use the project id as
@@ -463,6 +469,9 @@ files_schema = {
'file_path': {
'type': 'string',
},
'link': {
'type': 'string',
}
}
}
},