cubicweb #472792 Save the file contents in an external file pool [resolved]
since files can be big, and their content rarely change, it can be benificial to store them outside the database. This especially helps backup system that do file pooling, or simply incremental backups.
A simple and hopefully safe strategy for insertion, update, remove of file content is to do:
begin create a unique filename for the content pick a path in the pool and do save file content select previous filename if available insert/update row containing new filename if retrieving file data, open the file now commit
by now the transaction is over and the new file content is available. all select after the transaction return the new filename we can delete the previous file, or leave a cleanup process do it for us.
if a session is actually reading the file, it should have opened it during the transaction, so that a unlink will remove the file's data only after the close.
|closed by||<not specified>|