summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-05-29 14:40:06 +0200
committerRobin Appelman <icewind@owncloud.com>2015-06-01 13:24:02 +0200
commit661c9e2444c097aad7e47b77df4fc2b10c346d04 (patch)
tree1d3481ae80822bd7ecbcbad534c2e64e9661496c
parenta1372b2fb5acc51eacf70012a6702a96c78e61ff (diff)
downloadnextcloud-server-661c9e2444c097aad7e47b77df4fc2b10c346d04.tar.gz
nextcloud-server-661c9e2444c097aad7e47b77df4fc2b10c346d04.zip
add changeLock to the storage api
-rw-r--r--apps/files_sharing/lib/sharedstorage.php11
-rw-r--r--lib/private/files/storage/common.php9
-rw-r--r--lib/private/files/storage/storage.php8
-rw-r--r--lib/private/files/storage/wrapper/jail.php9
-rw-r--r--lib/private/files/storage/wrapper/wrapper.php9
-rw-r--r--lib/public/files/storage.php8
6 files changed, 54 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index ad695836396..bf61dda3718 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -634,4 +634,15 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
list($targetStorage, $targetInternalPath) = $this->resolvePath($path);
$targetStorage->releaseLock($targetInternalPath, $type, $provider);
}
+
+ /**
+ * @param string $path
+ * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
+ * @param \OCP\Lock\ILockingProvider $provider
+ */
+ public function changeLock($path, $type, ILockingProvider $provider) {
+ /** @var \OCP\Files\Storage $targetStorage */
+ list($targetStorage, $targetInternalPath) = $this->resolvePath($path);
+ $targetStorage->changeLock($targetInternalPath, $type, $provider);
+ }
}
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php
index f0c9e1bfa05..847cb8492fe 100644
--- a/lib/private/files/storage/common.php
+++ b/lib/private/files/storage/common.php
@@ -641,4 +641,13 @@ abstract class Common implements Storage {
public function releaseLock($path, $type, ILockingProvider $provider) {
$provider->releaseLock('files/' . md5($this->getId() . '::' . trim($path, '/')), $type);
}
+
+ /**
+ * @param string $path
+ * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
+ * @param \OCP\Lock\ILockingProvider $provider
+ */
+ public function changeLock($path, $type, ILockingProvider $provider) {
+ $provider->changeLock('files/' . md5($this->getId() . '::' . trim($path, '/')), $type);
+ }
}
diff --git a/lib/private/files/storage/storage.php b/lib/private/files/storage/storage.php
index 642544bad37..bd809099e1f 100644
--- a/lib/private/files/storage/storage.php
+++ b/lib/private/files/storage/storage.php
@@ -91,4 +91,12 @@ interface Storage extends \OCP\Files\Storage {
* @param \OCP\Lock\ILockingProvider $provider
*/
public function releaseLock($path, $type, ILockingProvider $provider);
+
+ /**
+ * @param string $path The path of the file to change the lock for
+ * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
+ * @param \OCP\Lock\ILockingProvider $provider
+ * @throws \OCP\Lock\LockedException
+ */
+ public function changeLock($path, $type, ILockingProvider $provider);
}
diff --git a/lib/private/files/storage/wrapper/jail.php b/lib/private/files/storage/wrapper/jail.php
index 229d12e82fa..2857e74de46 100644
--- a/lib/private/files/storage/wrapper/jail.php
+++ b/lib/private/files/storage/wrapper/jail.php
@@ -444,4 +444,13 @@ class Jail extends Wrapper {
public function releaseLock($path, $type, ILockingProvider $provider) {
$this->storage->releaseLock($this->getSourcePath($path), $type, $provider);
}
+
+ /**
+ * @param string $path
+ * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
+ * @param \OCP\Lock\ILockingProvider $provider
+ */
+ public function changeLock($path, $type, ILockingProvider $provider) {
+ $this->storage->changeLock($this->getSourcePath($path), $type, $provider);
+ }
}
diff --git a/lib/private/files/storage/wrapper/wrapper.php b/lib/private/files/storage/wrapper/wrapper.php
index 6aca771c0bf..d1414880beb 100644
--- a/lib/private/files/storage/wrapper/wrapper.php
+++ b/lib/private/files/storage/wrapper/wrapper.php
@@ -561,4 +561,13 @@ class Wrapper implements \OC\Files\Storage\Storage {
public function releaseLock($path, $type, ILockingProvider $provider) {
$this->storage->releaseLock($path, $type, $provider);
}
+
+ /**
+ * @param string $path
+ * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
+ * @param \OCP\Lock\ILockingProvider $provider
+ */
+ public function changeLock($path, $type, ILockingProvider $provider) {
+ $this->storage->changeLock($path, $type, $provider);
+ }
}
diff --git a/lib/public/files/storage.php b/lib/public/files/storage.php
index 68d00fab34c..ee160c50e89 100644
--- a/lib/public/files/storage.php
+++ b/lib/public/files/storage.php
@@ -429,4 +429,12 @@ interface Storage {
* @param \OCP\Lock\ILockingProvider $provider
*/
public function releaseLock($path, $type, ILockingProvider $provider);
+
+ /**
+ * @param string $path The path of the file to change the lock for
+ * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
+ * @param \OCP\Lock\ILockingProvider $provider
+ * @throws \OCP\Lock\LockedException
+ */
+ public function changeLock($path, $type, ILockingProvider $provider);
}