use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\Files\Storage\IDisableEncryptionStorage;
+use OCP\Files\Storage\ILockingStorage;
use OCP\Files\Storage\ISharedStorage;
use OCP\Files\Storage\IStorage;
use OCP\Lock\ILockingProvider;
* @throws \OCP\Lock\LockedException
*/
public function acquireLock($path, $type, ILockingProvider $provider) {
- /** @var \OCP\Files\Storage $targetStorage */
+ /** @var ILockingStorage $targetStorage */
[$targetStorage, $targetInternalPath] = $this->resolvePath($path);
$targetStorage->acquireLock($targetInternalPath, $type, $provider);
// lock the parent folders of the owner when locking the share as recipient
* @param \OCP\Lock\ILockingProvider $provider
*/
public function releaseLock($path, $type, ILockingProvider $provider) {
- /** @var \OCP\Files\Storage $targetStorage */
+ /** @var ILockingStorage $targetStorage */
[$targetStorage, $targetInternalPath] = $this->resolvePath($path);
$targetStorage->releaseLock($targetInternalPath, $type, $provider);
// unlock the parent folders of the owner when unlocking the share as recipient
* @param \OCP\Lock\ILockingProvider $provider
*/
public function changeLock($path, $type, ILockingProvider $provider) {
- /** @var \OCP\Files\Storage $targetStorage */
+ /** @var ILockingStorage $targetStorage */
[$targetStorage, $targetInternalPath] = $this->resolvePath($path);
$targetStorage->changeLock($targetInternalPath, $type, $provider);
}
$view = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
$this->assertTrue($view->file_exists($this->folder));
- /**
- * @var \OCP\Files\Storage $sharedStorage
- */
[$sharedStorage,] = $view->resolvePath($this->folder);
$this->assertTrue($sharedStorage->instanceOfStorage('OCA\Files_Sharing\ISharedStorage'));
$view = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
$this->assertTrue($view->file_exists($this->folder));
- /**
- * @var \OCP\Files\Storage $sharedStorage
- */
[$sharedStorage,] = $view->resolvePath($this->folder);
$this->assertTrue($sharedStorage->instanceOfStorage('OCA\Files_Sharing\ISharedStorage'));
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
* SPDX-License-Identifier: AGPL-3.0-only
*/
+
namespace OC\Files\Storage;
-use OCP\Lock\ILockingProvider;
+use OCP\Files\Storage\IStorage;
/**
* Provide a common interface to all different storage options
*
* All paths passed to the storage are relative to the storage and should NOT have a leading slash.
*/
-interface Storage extends \OCP\Files\Storage {
- /**
- * get a cache instance for the storage
- *
- * @param string $path
- * @param \OC\Files\Storage\Storage|null (optional) the storage to pass to the cache
- * @return \OC\Files\Cache\Cache
- */
- public function getCache($path = '', $storage = null);
-
- /**
- * get a scanner instance for the storage
- *
- * @param string $path
- * @param \OC\Files\Storage\Storage (optional) the storage to pass to the scanner
- * @return \OC\Files\Cache\Scanner
- */
- public function getScanner($path = '', $storage = null);
-
-
- /**
- * get the user id of the owner of a file or folder
- *
- * @param string $path
- * @return string
- */
- public function getOwner($path);
-
- /**
- * get a watcher instance for the cache
- *
- * @param string $path
- * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher
- * @return \OC\Files\Cache\Watcher
- */
- public function getWatcher($path = '', $storage = null);
-
- /**
- * get a propagator instance for the cache
- *
- * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher
- * @return \OC\Files\Cache\Propagator
- */
- public function getPropagator($storage = null);
-
- /**
- * get a updater instance for the cache
- *
- * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher
- * @return \OC\Files\Cache\Updater
- */
- public function getUpdater($storage = null);
-
+interface Storage extends IStorage {
/**
* @return \OC\Files\Cache\Storage
*/
*/
public function getMetaData($path);
- /**
- * @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
- */
- public function acquireLock($path, $type, ILockingProvider $provider);
-
- /**
- * @param string $path The path of the file to release 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 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);
-
/**
* Get the contents of a directory with metadata
*
namespace OC\Files\Storage;
use OCP\Files\Mount\IMountPoint;
+use OCP\Files\Storage\IStorage;
use OCP\Files\Storage\IStorageFactory;
class StorageFactory implements IStorageFactory {
/**
* Create an instance of a storage and apply the registered storage wrappers
*
- * @param \OCP\Files\Mount\IMountPoint $mountPoint
* @param string $class
* @param array $arguments
- * @return \OCP\Files\Storage
+ * @return IStorage
*/
public function getInstance(IMountPoint $mountPoint, $class, $arguments) {
return $this->wrap($mountPoint, new $class($arguments));
}
/**
- * @param \OCP\Files\Mount\IMountPoint $mountPoint
- * @param \OCP\Files\Storage $storage
- * @return \OCP\Files\Storage
+ * @param IStorage $storage
+ * @return IStorage
*/
public function wrap(IMountPoint $mountPoint, $storage) {
$wrappers = array_values($this->storageWrappers);
}, $wrappers);
foreach ($wrappers as $wrapper) {
$storage = $wrapper($mountPoint->getMountPoint(), $storage, $mountPoint);
- if (!($storage instanceof \OCP\Files\Storage)) {
+ if (!($storage instanceof IStorage)) {
throw new \Exception('Invalid result from storage wrapper');
}
}
*/
public function free_space($path);
+ /**
+ * search for occurrences of $query in file names
+ *
+ * @param string $query
+ * @return array|bool
+ * @since 6.0.0
+ */
+ public function search($query);
+
/**
* see https://www.php.net/manual/en/function.touch.php
* If the backend does not support the operation, false should be returned
*/
public function setAvailability($isAvailable);
+ /**
+ * @since 12.0.0
+ * @return mixed
+ */
+ public function needsPartFile();
+
/**
* @param string $path path for which to retrieve the owner
* @since 9.0.0
namespace Test\Files\Storage;
use OC\Files\Cache\Watcher;
+use OCP\Files\Storage\IStorage;
use OCP\Files\Storage\IWriteStreamStorage;
abstract class Storage extends \Test\TestCase {
}
public function testInstanceOfStorage(): void {
- $this->assertTrue($this->instance->instanceOfStorage('\OCP\Files\Storage'));
+ $this->assertTrue($this->instance->instanceOfStorage(IStorage::class));
$this->assertTrue($this->instance->instanceOfStorage(get_class($this->instance)));
$this->assertFalse($this->instance->instanceOfStorage('\OC'));
}
use OC\Files\Mount\MountPoint;
use OC\Files\Storage\Wrapper\Wrapper;
use OCP\Files\Mount\IMountPoint;
-use OCP\Files\Storage as IStorage;
+use OCP\Files\Storage\IStorage;
use Test\TestCase;
class DummyWrapper extends Wrapper {