2016-01-04 16:07:03 +03:00
|
|
|
<?php
|
|
|
|
/**
|
2016-07-21 18:07:57 +03:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
|
|
|
*
|
2017-11-06 17:56:42 +03:00
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
2016-07-21 19:13:36 +03:00
|
|
|
* @author Robin Appelman <robin@icewind.nl>
|
2016-01-04 16:07:03 +03:00
|
|
|
*
|
|
|
|
* @license AGPL-3.0
|
|
|
|
*
|
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
2019-12-03 21:57:53 +03:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
2016-01-04 16:07:03 +03:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace OCP\Files\Storage;
|
|
|
|
|
|
|
|
use OCP\Lock\ILockingProvider;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Storage backends that require explicit locking
|
|
|
|
*
|
|
|
|
* Storage backends implementing this interface do not need to implement their own locking implementation but should use the provided lockingprovider instead
|
|
|
|
* The implementation of the locking methods only need to map internal storage paths to "lock keys"
|
|
|
|
*
|
|
|
|
* @since 9.0.0
|
|
|
|
*/
|
|
|
|
interface ILockingStorage {
|
|
|
|
/**
|
|
|
|
* @param string $path The path of the file to acquire 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
|
|
|
|
* @since 9.0.0
|
|
|
|
*/
|
|
|
|
public function acquireLock($path, $type, ILockingProvider $provider);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $path The path of the file to acquire the lock for
|
|
|
|
* @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
|
|
|
|
* @param \OCP\Lock\ILockingProvider $provider
|
2017-02-14 03:03:35 +03:00
|
|
|
* @throws \OCP\Lock\LockedException
|
2016-01-04 16:07:03 +03:00
|
|
|
* @since 9.0.0
|
|
|
|
*/
|
|
|
|
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
|
|
|
|
* @since 9.0.0
|
|
|
|
*/
|
|
|
|
public function changeLock($path, $type, ILockingProvider $provider);
|
|
|
|
}
|