aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Async
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2025-04-28 19:57:56 -0100
committerMaxence Lange <maxence@artificial-owl.com>2025-04-28 19:58:06 -0100
commit6d272ff894fa969e5a526caf6a91d60eda115c53 (patch)
treedf90f826a29f7169dd9b550f2e478a1b09d29e71 /lib/public/Async
parent10a01423ecfc7e028960eee8058bd177ad28d484 (diff)
downloadnextcloud-server-enh/noid/async-process-run.tar.gz
nextcloud-server-enh/noid/async-process-run.zip
feat(async): AsyncProcessenh/noid/async-process-run
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/public/Async')
-rw-r--r--lib/public/Async/Enum/BlockActivity.php18
-rw-r--r--lib/public/Async/Enum/BlockStatus.php20
-rw-r--r--lib/public/Async/Enum/ProcessExecutionTime.php17
-rw-r--r--lib/public/Async/IAsyncProcess.php20
4 files changed, 75 insertions, 0 deletions
diff --git a/lib/public/Async/Enum/BlockActivity.php b/lib/public/Async/Enum/BlockActivity.php
new file mode 100644
index 00000000000..ee8cf12d825
--- /dev/null
+++ b/lib/public/Async/Enum/BlockActivity.php
@@ -0,0 +1,18 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCP\Async\Enum;
+
+enum BlockActivity: int {
+ case STARTING = 0;
+ case DEBUG = 1;
+ case NOTICE = 2;
+ case WARNING = 3;
+ case ERROR = 4;
+ case ENDING = 9;
+}
diff --git a/lib/public/Async/Enum/BlockStatus.php b/lib/public/Async/Enum/BlockStatus.php
new file mode 100644
index 00000000000..83485880a8e
--- /dev/null
+++ b/lib/public/Async/Enum/BlockStatus.php
@@ -0,0 +1,20 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCP\Async\Enum;
+
+enum BlockStatus: int {
+ case PREP = 0;
+ case STANDBY = 1;
+ case RUNNING = 4;
+
+ case BLOCKER = 7;
+ case ERROR = 8;
+ case SUCCESS = 9;
+}
diff --git a/lib/public/Async/Enum/ProcessExecutionTime.php b/lib/public/Async/Enum/ProcessExecutionTime.php
new file mode 100644
index 00000000000..600bdce3c91
--- /dev/null
+++ b/lib/public/Async/Enum/ProcessExecutionTime.php
@@ -0,0 +1,17 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCP\Async\Enum;
+
+enum ProcessExecutionTime: int {
+ case NOW = 0;
+ case ASAP = 1;
+ case LATER = 2;
+ case ON_REQUEST = 9;
+}
diff --git a/lib/public/Async/IAsyncProcess.php b/lib/public/Async/IAsyncProcess.php
new file mode 100644
index 00000000000..9e32178a1cf
--- /dev/null
+++ b/lib/public/Async/IAsyncProcess.php
@@ -0,0 +1,20 @@
+<?php
+
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Async;
+
+use OC\Async\IBlockInterface;
+use OCP\Async\Enum\ProcessExecutionTime;
+
+interface IAsyncProcess {
+ public function exec(\Closure $closure, ...$params): IBlockInterface;
+
+ public function invoke(callable $obj, ...$params): IBlockInterface;
+
+ public function call(string $class, ...$params): IBlockInterface;
+
+ public function async(ProcessExecutionTime $time = ProcessExecutionTime::NOW): string;
+}