You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are usecases where someone want´s to plug a 3rd party system or any workflow into the ownCloud upload/download/share actions.
Examples are:
Everytime someone uploads a file the virusscanner needs to run and than delete or move the file and send a notification. This partly exists in the current virusscanner app already.
Everytime a file is uploaded or changed a copy of it has to be put into a 3rd party filestorage for archiving because of legal regulations.
Everytime someone shares a file with someone or this person gownloads the shared file the file has to be automatically encrypted by a 3rd party tool that ownCloud executes. Alternatively the file has to be digitally signed by this 3rd party tool.
Everytime a file is uploded into a specific folder a copy is put into a second folder and the files is automatically converted to pdf and password protected by an external cli tool.
Everytime someone uploads a csv file into a specific folder an external python script is called to do scientific analysis of the data and puts a report into the same folder later.
The ownCloud core should make it happen that all this actions can be added to ownCloud as apps to plug into the ownCloud file workflow. Some of this external scripts or applications are long running so we can´t do everything synchronously.
What we need is an extension to the current API/hooks that make it possible to implement this external file workflows.
Absolutely!
But the expectation for the v1.0 of this feature is to have no user interface at all but have only the necessary hooks and APIs to make implementation of this features in apps possible. If you want to build one if the use cases for testing than this would be cool too of course :-)
The question is also, what to do with the old hooks/proxies ? Because it sounds like this will add yet another hook/proxy mechanism. Or... we need to try and reuse the existing architecture and just add a few new hooks for apps to hook into.
First we should think about the proper architecture and APIs to enable this. @bantu@DeepDiver1975 Perhaps you guys have an idea already.
I don´t think we should kill the old hook system yet because it actually works well and is widely used.
Asynchronous processing is hard with PHP, due to its single threaded shared nothing architecture.
A generic solution for immediately starting an asynchronous task: gather all execution details, make a HTTP request with the job details to a job handler. Depending on the web server and PHP configuration, this may or may not work well. In an nginx + php-fpm setup, this will especially not result in the immediate creation of a thread; the job will merely be queued in the webserver. The tricky part nevertheless is not to create too many async jobs as they might block other PHP requests at some point. Furthermore, all jobs are constrained by PHP timeouts etc. Also see http://stackoverflow.com/a/5666094
Other generic solutions include adding individual jobs to a queue that are then processed and removed by background processes. In a constrained PHP environment, this queue would be stored in the RDBMS database, which is not the ideal place to store such a queue, especially because job deletion is expensive. Not sure this is going to scale so well with a lot of background job workers, some DB tricks might be necessary. In a non-constrained environment, proper queuing software could be used.
Instead of submitting jobs to a queue, it is also possible to consider the whole working set and mark items that have been processes, possibly with multiple states as explained in #12024. This solution costs more storage, which may however be negligible. Also see my comment #12024 (comment)
I am not sure there is a one fits it all solution.
Another option would be to not change the current hook system but to only add an API/hook that implements this:
From an app perspective that want´s to implement a workflow like that:
Whenever a file is uploaded give me the file and stop the uploading operation so that I can handle something asynchronously.
Whenever I´m done with processing the file I just inject/upload the file again. Maybe normal WebDAV is enough.
@karlitschek Stopping the upload operation and then reuploading does not sound asynchronous at all. What do you want to tell the user? "Upload operation was successful"? But then, he won't be able to access the file as it is being processed in the background.
Everytime someone uploads a file the virusscanner needs to run and than delete or move the file and send a notification. This partly exists in the current virusscanner app already.
If this runs synchronously after the file was completely uploaded, the file has to be reread and this might further delay the operation. If this is run asynchronously, an infected file might be distributed. IMO the correct solution is to have this synchronous but use streaming. Basically stream the file from the browser through the virus scanner onto target storage. If the file is found to be affected, the virusscanner aborts the whole operation.
Activity
karlitschek commentedon Nov 8, 2014
@bantu @DeepDiver1975 as discussed. Would be great if you could look into that.
karlitschek commentedon Nov 8, 2014
@MTRichards @craigpg FYI
LukasReschke commentedon Nov 8, 2014
Isn't this quite similiar to #12024?
karlitschek commentedon Nov 8, 2014
Yes. It actually is :-)
DeepDiver1975 commentedon Nov 8, 2014
If you all agree I will sit together with @jancborchardt and think about the UX of this feature. We will come up with sone mockups.
karlitschek commentedon Nov 8, 2014
Absolutely!
But the expectation for the v1.0 of this feature is to have no user interface at all but have only the necessary hooks and APIs to make implementation of this features in apps possible. If you want to build one if the use cases for testing than this would be cool too of course :-)
PVince81 commentedon Nov 10, 2014
The question is also, what to do with the old hooks/proxies ? Because it sounds like this will add yet another hook/proxy mechanism. Or... we need to try and reuse the existing architecture and just add a few new hooks for apps to hook into.
jancborchardt commentedon Nov 10, 2014
Yeah, this sounds more like something which should be done in the background it seems, no user interface should be there / is needed for now.
karlitschek commentedon Nov 10, 2014
First we should think about the proper architecture and APIs to enable this. @bantu @DeepDiver1975 Perhaps you guys have an idea already.
I don´t think we should kill the old hook system yet because it actually works well and is widely used.
bantu commentedon Nov 10, 2014
Asynchronous processing is hard with PHP, due to its single threaded shared nothing architecture.
A generic solution for immediately starting an asynchronous task: gather all execution details, make a HTTP request with the job details to a job handler. Depending on the web server and PHP configuration, this may or may not work well. In an nginx + php-fpm setup, this will especially not result in the immediate creation of a thread; the job will merely be queued in the webserver. The tricky part nevertheless is not to create too many async jobs as they might block other PHP requests at some point. Furthermore, all jobs are constrained by PHP timeouts etc. Also see http://stackoverflow.com/a/5666094
Other generic solutions include adding individual jobs to a queue that are then processed and removed by background processes. In a constrained PHP environment, this queue would be stored in the RDBMS database, which is not the ideal place to store such a queue, especially because job deletion is expensive. Not sure this is going to scale so well with a lot of background job workers, some DB tricks might be necessary. In a non-constrained environment, proper queuing software could be used.
Instead of submitting jobs to a queue, it is also possible to consider the whole working set and mark items that have been processes, possibly with multiple states as explained in #12024. This solution costs more storage, which may however be negligible. Also see my comment #12024 (comment)
I am not sure there is a one fits it all solution.
karlitschek commentedon Nov 10, 2014
Another option would be to not change the current hook system but to only add an API/hook that implements this:
From an app perspective that want´s to implement a workflow like that:
bantu commentedon Nov 10, 2014
@karlitschek Stopping the upload operation and then reuploading does not sound asynchronous at all. What do you want to tell the user? "Upload operation was successful"? But then, he won't be able to access the file as it is being processed in the background.
bantu commentedon Nov 10, 2014
If this runs synchronously after the file was completely uploaded, the file has to be reread and this might further delay the operation. If this is run asynchronously, an infected file might be distributed. IMO the correct solution is to have this synchronous but use streaming. Basically stream the file from the browser through the virus scanner onto target storage. If the file is found to be affected, the virusscanner aborts the whole operation.
5 remaining items
DeepDiver1975 commentedon Dec 1, 2014
@PVince81 @bantu I need input on the ideas above - not too sure about this approach to be honest ..
DeepDiver1975 commentedon Jan 6, 2015
@karlitschek if this feature is still on our roadmap - I'd like to push this to OC8.1
karlitschek commentedon Jan 6, 2015
definitely 8.1
DeepDiver1975 commentedon Mar 2, 2015
Pushing to 8.2 - still needs discussion ...
MorrisJobke commentedon Aug 29, 2015
@janklostermann this is what we talked about ;)
lock commentedon Aug 3, 2019
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.