-
Notifications
You must be signed in to change notification settings - Fork 69
Feature: Callbacks for file operations #69
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
Comments
hm, this is supposed to be an FTP Server, not a filesystem watcher. What is your use case? |
@Tinker-zzz you mean for the library to raise events based on FTP actions performed on the FTP server? |
@ShaharHD Yes, that's exactly what I mean |
@FlorianReimold I can add the ability to map async lambda function for events if you see it as a valid option. I can make it as a method called after construction and before |
Reopeing this issue, as there seems to be some interest @ShaharHD: What do you mean by async lambda function? Which thread will be executing them? Do you have a similar use case or are you interested in the implementation alone? |
An automatictly created short lived thread for the async. My use case for it is to get events on the FTP server (which I can then act upon in my main application, in my case mailny progressing a FSM and updating statistics) as far as async lambda - like so: #include <iostream>
#include <future>
int main() {
auto async_lambda = std::async(std::launch::async, []() {
// Code to be executed asynchronously
std::cout << "Async lambda execution" << std::endl;
return 42;
});
// Perform other tasks while the lambda executes
// Get the result from the async lambda (this will block until the lambda is done)
int result = async_lambda.get();
std::cout << "Result from async lambda: " << result << std::endl;
return 0;
} But it'll be a |
OK, sounds reasonable. Can you make a proposal? |
@Tinker-zzz I was thinking on "download" and "upload" events - but I can go "full monty" here. For example: |
Hm, if you cover download and upload events, you also have to cover renaming, appending, deleting, creating directories etc., so that all filesystem operations can perform callbacks. I think a signature like Callback(enum callback_type, ????) would simplify this a lot, so the user doesn't have to set dozens of callbacks. |
I'll do a PR with initial offer next week - see how and if it fits your project design. |
I hope that this library can monitor the FTP folder, such as add, update, delete files can have similar callback interface can be provided to need the function of the third party
What do you think of this feature?
The text was updated successfully, but these errors were encountered: