digineo / texd

texd wraps TeX in a web API
MIT License
8 stars 1 forks source link

refstore: implement data retention policy #5

Closed dmke closed 2 years ago

dmke commented 2 years ago

Currently, texd saves files sent with application/x.texd; ref=store content type on disk, but never deletes them.

Users should be able to define a retention policy using the DSN. For the dir adapter, DSN parameters could look like this:

Since a file's atime attribute is unreliable (nowadays, Linux file systems are mounted with noatime option), we need to either update the reference's mtime on access, or come up with an alternative.

@corny suggested to keep an in-memory map (from reference hash to last-access timestamp), and prime it on startup with the mtime of existing reference files. I like that idea.

dmke commented 2 years ago

Current plan is to use a generic retention-policy query parameter, since this is not specific to the dir adapter (any adapter is free to ignore or err when encountering these parameters, though).

Possible values: