summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-05-21 19:08:15 +0200
committerVincent Petry <pvince81@owncloud.com>2016-05-21 19:08:15 +0200
commit8646802850af3ace50e88292f653eb449f959192 (patch)
tree0130972598d1b5e7da4e377726668b57d626e909 /lib/public
parent693484008360b219848d4fbcdce9b7f26987850b (diff)
parent92c21fd6f456d083af8fa64a713c9a0e8d59d1c1 (diff)
downloadnextcloud-server-8646802850af3ace50e88292f653eb449f959192.tar.gz
nextcloud-server-8646802850af3ace50e88292f653eb449f959192.zip
Merge pull request #24696 from owncloud/lock-jobs-while-executing
Lock jobs while executing them, to allow multiple executors to run in…
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/BackgroundJob/IJobList.php11
-rw-r--r--lib/public/IDBConnection.php19
2 files changed, 30 insertions, 0 deletions
diff --git a/lib/public/BackgroundJob/IJobList.php b/lib/public/BackgroundJob/IJobList.php
index 5a76ce1ba26..9e401e68419 100644
--- a/lib/public/BackgroundJob/IJobList.php
+++ b/lib/public/BackgroundJob/IJobList.php
@@ -93,10 +93,21 @@ interface IJobList {
public function setLastJob($job);
/**
+ * Remove the reservation for a job
+ *
+ * @param IJob $job
+ * @since 9.1.0
+ */
+ public function unlockJob($job);
+
+ /**
* get the id of the last ran job
*
* @return int
* @since 7.0.0
+ * @deprecated 9.1.0 - The functionality behind the value is deprecated, it
+ * only tells you which job finished last, but since we now allow multiple
+ * executors to run in parallel, it's not used to calculate the next job.
*/
public function getLastJob();
diff --git a/lib/public/IDBConnection.php b/lib/public/IDBConnection.php
index 780fcd26364..4ecf01ca27e 100644
--- a/lib/public/IDBConnection.php
+++ b/lib/public/IDBConnection.php
@@ -125,6 +125,25 @@ interface IDBConnection {
public function setValues($table, array $keys, array $values, array $updatePreconditionValues = []);
/**
+ * Create an exclusive read+write lock on a table
+ *
+ * Important Note: Due to the nature how locks work on different DBs, it is
+ * only possible to lock one table at a time. You should also NOT start a
+ * transaction while holding a lock.
+ *
+ * @param string $tableName
+ * @since 9.1.0
+ */
+ public function lockTable($tableName);
+
+ /**
+ * Release a previous acquired lock again
+ *
+ * @since 9.1.0
+ */
+ public function unlockTable();
+
+ /**
* Start a transaction
* @since 6.0.0
*/