aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Lock
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-04-22 15:00:20 +0200
committerCarl Schwan <carl@carlschwan.eu>2022-05-12 15:09:58 +0200
commitfcae6a68c347e2913cc29f45648be37789f09c29 (patch)
tree5b1b58b359b424497b86abe870437ae4342ee0ce /lib/public/Lock
parent9a76f06ecadf05ef1d26bd735df1bea0dfb15d59 (diff)
downloadnextcloud-server-fcae6a68c347e2913cc29f45648be37789f09c29.tar.gz
nextcloud-server-fcae6a68c347e2913cc29f45648be37789f09c29.zip
Cleanup lock related code
- Port to QueryBuilder - Improve the doc a bit - Add type hinting Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'lib/public/Lock')
-rw-r--r--lib/public/Lock/ILockingProvider.php36
1 files changed, 17 insertions, 19 deletions
diff --git a/lib/public/Lock/ILockingProvider.php b/lib/public/Lock/ILockingProvider.php
index 3dc7c73b6eb..a2015d42f47 100644
--- a/lib/public/Lock/ILockingProvider.php
+++ b/lib/public/Lock/ILockingProvider.php
@@ -28,7 +28,10 @@ declare(strict_types=1);
namespace OCP\Lock;
/**
- * Interface ILockingProvider
+ * This interface allows locking and unlocking filesystem paths
+ *
+ * This interface should be used directly and not implemented by an application.
+ * The implementation is provided by the server.
*
* @since 8.1.0
*/
@@ -43,42 +46,37 @@ interface ILockingProvider {
public const LOCK_EXCLUSIVE = 2;
/**
- * @param string $path
- * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE
- * @return bool
+ * @psalm-param self::LOCK_SHARED|self::LOCK_EXCLUSIVE $type
* @since 8.1.0
*/
public function isLocked(string $path, int $type): bool;
/**
- * @param string $path
- * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE
- * @param string $readablePath human readable path to use in error messages, since 20.0.0
- * @throws \OCP\Lock\LockedException
+ * @psalm-param self::LOCK_SHARED|self::LOCK_EXCLUSIVE $type
+ * @param ?string $readablePath A human-readable path to use in error messages, since 20.0.0
+ * @throws LockedException
* @since 8.1.0
*/
- public function acquireLock(string $path, int $type, string $readablePath = null);
+ public function acquireLock(string $path, int $type, ?string $readablePath = null): void;
/**
- * @param string $path
- * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE
+ * @psalm-param self::LOCK_SHARED|self::LOCK_EXCLUSIVE $type
* @since 8.1.0
*/
- public function releaseLock(string $path, int $type);
+ public function releaseLock(string $path, int $type): void;
/**
- * Change the type of an existing lock
+ * Change the target type of an existing lock
*
- * @param string $path
- * @param int $targetType self::LOCK_SHARED or self::LOCK_EXCLUSIVE
- * @throws \OCP\Lock\LockedException
+ * @psalm-param self::LOCK_SHARED|self::LOCK_EXCLUSIVE $targetType
+ * @throws LockedException
* @since 8.1.0
*/
- public function changeLock(string $path, int $targetType);
+ public function changeLock(string $path, int $targetType): void;
/**
- * release all lock acquired by this instance
+ * Release all lock acquired by this instance
* @since 8.1.0
*/
- public function releaseAll();
+ public function releaseAll(): void;
}