New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: please add on_file_removed hook #379

Open
osallou opened this Issue Apr 13, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@osallou

osallou commented Apr 13, 2016

FTPHandler provide a hook on_file_received but there is no hook when a file is deleted.
It would be usefull to manage disk quota (increasing on on_file_received and decreasing on on_file_removed).

hook could either give file stats (name, size, date, ...) after deletion or be called before deletion with file path (first option would be better to be sure file has really been deleted).

I think I could manage this for the moment overriding ftp_DELE(self, path) method, but it would be nice to keep same mechanism.

@giampaolo

This comment has been minimized.

Show comment
Hide comment
@giampaolo

giampaolo Apr 13, 2016

Owner

Uhm... both approaches doesn't convince me (and that's why such a hook is currently not provided).
Before deletion: you have the path but you don't know if it will be removed.
After deletion: you have the path but you no longer have the file to query. We can query the file before deleting it but we're not sure what information to query exactly. Size is probably not enough. stat() would be better because it provides a lot of information about the file but that would mean the FileSystem class must be "stat aware" and that may be difficult for not conventional filesystems (e.g. database "fake" file). I'm not sure... I have to think about it.

Owner

giampaolo commented Apr 13, 2016

Uhm... both approaches doesn't convince me (and that's why such a hook is currently not provided).
Before deletion: you have the path but you don't know if it will be removed.
After deletion: you have the path but you no longer have the file to query. We can query the file before deleting it but we're not sure what information to query exactly. Size is probably not enough. stat() would be better because it provides a lot of information about the file but that would mean the FileSystem class must be "stat aware" and that may be difficult for not conventional filesystems (e.g. database "fake" file). I'm not sure... I have to think about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment