summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-02-26 15:10:13 +0100
committerMorris Jobke <hey@morrisjobke.de>2015-02-26 15:10:13 +0100
commit0c1e6fad6c5beda21a7debc7672ff342d737635e (patch)
tree84a5512789e4ed0f4dc5fcd2c77fbdb27e954e70 /lib/public
parenta183b5d7e208222faa4fa193969faf2f89058a5b (diff)
parent27fde80ee6bb88fcf4a1c8943829fe6360a12575 (diff)
downloadnextcloud-server-0c1e6fad6c5beda21a7debc7672ff342d737635e.tar.gz
nextcloud-server-0c1e6fad6c5beda21a7debc7672ff342d737635e.zip
Merge pull request #14300 from owncloud/commandbus
Add async command system to handle asynchronous operations
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/command/ibus.php25
-rw-r--r--lib/public/command/icommand.php16
-rw-r--r--lib/public/iservercontainer.php5
3 files changed, 46 insertions, 0 deletions
diff --git a/lib/public/command/ibus.php b/lib/public/command/ibus.php
new file mode 100644
index 00000000000..bbb89ee04e6
--- /dev/null
+++ b/lib/public/command/ibus.php
@@ -0,0 +1,25 @@
+<?php
+/**
+ * Copyright (c) 2015 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OCP\Command;
+
+interface IBus {
+ /**
+ * Schedule a command to be fired
+ *
+ * @param \OCP\Command\ICommand | callable $command
+ */
+ public function push($command);
+
+ /**
+ * Require all commands using a trait to be run synchronous
+ *
+ * @param string $trait
+ */
+ public function requireSync($trait);
+}
diff --git a/lib/public/command/icommand.php b/lib/public/command/icommand.php
new file mode 100644
index 00000000000..6de61258a41
--- /dev/null
+++ b/lib/public/command/icommand.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Copyright (c) 2015 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OCP\Command;
+
+interface ICommand {
+ /**
+ * Run the command
+ */
+ public function handle();
+}
diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php
index 1dbabb3452a..df963b78a03 100644
--- a/lib/public/iservercontainer.php
+++ b/lib/public/iservercontainer.php
@@ -318,4 +318,9 @@ interface IServerContainer {
* @return \bantu\IniGetWrapper\IniGetWrapper
*/
function getIniWrapper();
+
+ /**
+ * @return \OCP\Command\IBus
+ */
+ function getCommandBus();
}