summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-01-22 11:01:54 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-01-22 11:01:54 +0100
commit141012075839f1f08cb42aa14396ae69e024f97f (patch)
tree84621be2e56c15fe21eabbfe74a681cacdf61bd4 /lib/public
parente2e5eedb40a15ef3a6971e2145abec24873c4400 (diff)
parent8a4c0829fb79c1836962122be048c020b9f019b4 (diff)
downloadnextcloud-server-141012075839f1f08cb42aa14396ae69e024f97f.tar.gz
nextcloud-server-141012075839f1f08cb42aa14396ae69e024f97f.zip
Merge pull request #20768 from owncloud/mount-cache
cache mountpoints in the db
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/files/config/icachedmountinfo.php62
-rw-r--r--lib/public/files/config/imountprovidercollection.php9
-rw-r--r--lib/public/files/config/iusermountcache.php89
3 files changed, 160 insertions, 0 deletions
diff --git a/lib/public/files/config/icachedmountinfo.php b/lib/public/files/config/icachedmountinfo.php
new file mode 100644
index 00000000000..a587427f1f2
--- /dev/null
+++ b/lib/public/files/config/icachedmountinfo.php
@@ -0,0 +1,62 @@
+<?php
+/**
+ * @author Robin Appelman <icewind@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @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,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCP\Files\Config;
+
+use OCP\Files\Node;
+use OCP\IUser;
+
+/**
+ * Holds information about a mount for a user
+ *
+ * @since 9.0.0
+ */
+interface ICachedMountInfo {
+ /**
+ * @return IUser
+ * @since 9.0.0
+ */
+ public function getUser();
+
+ /**
+ * @return int the numeric storage id of the mount
+ * @since 9.0.0
+ */
+ public function getStorageId();
+
+ /**
+ * @return int the fileid of the root of the mount
+ * @since 9.0.0
+ */
+ public function getRootId();
+
+ /**
+ * @return Node the root node of the mount
+ * @since 9.0.0
+ */
+ public function getMountPointNode();
+
+ /**
+ * @return string the mount point of the mount for the user
+ * @since 9.0.0
+ */
+ public function getMountPoint();
+}
diff --git a/lib/public/files/config/imountprovidercollection.php b/lib/public/files/config/imountprovidercollection.php
index 43b4bd0ce00..39da61812a9 100644
--- a/lib/public/files/config/imountprovidercollection.php
+++ b/lib/public/files/config/imountprovidercollection.php
@@ -22,6 +22,7 @@
namespace OCP\Files\Config;
+use OCP\Files\Mount\IMountPoint;
use OCP\IUser;
/**
@@ -45,4 +46,12 @@ interface IMountProviderCollection {
* @since 8.0.0
*/
public function registerProvider(IMountProvider $provider);
+
+ /**
+ * Get the mount cache which can be used to search for mounts without setting up the filesystem
+ *
+ * @return IUserMountCache
+ * @since 9.0.0
+ */
+ public function getMountCache();
}
diff --git a/lib/public/files/config/iusermountcache.php b/lib/public/files/config/iusermountcache.php
new file mode 100644
index 00000000000..f722ad16310
--- /dev/null
+++ b/lib/public/files/config/iusermountcache.php
@@ -0,0 +1,89 @@
+<?php
+/**
+ * @author Robin Appelman <icewind@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @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,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCP\Files\Config;
+
+use OCP\Files\Mount\IMountPoint;
+use OCP\IUser;
+
+/**
+ * Cache mounts points per user in the cache so we can easily look them up
+ *
+ * @since 9.0.0
+ */
+interface IUserMountCache {
+ /**
+ * Register mounts for a user to the cache
+ *
+ * @param IUser $user
+ * @param IMountPoint[] $mounts
+ * @since 9.0.0
+ */
+ public function registerMounts(IUser $user, array $mounts);
+
+ /**
+ * @param IUser $user
+ * @return ICachedMountInfo[]
+ * @since 9.0.0
+ */
+ public function getMountsForUser(IUser $user);
+
+ /**
+ * @param int $numericStorageId
+ * @return ICachedMountInfo[]
+ * @since 9.0.0
+ */
+ public function getMountsForStorageId($numericStorageId);
+
+ /**
+ * @param int $rootFileId
+ * @return ICachedMountInfo[]
+ * @since 9.0.0
+ */
+ public function getMountsForRootId($rootFileId);
+
+ /**
+ * Remove all cached mounts for a user
+ *
+ * @param IUser $user
+ * @since 9.0.0
+ */
+ public function removeUserMounts(IUser $user);
+
+ /**
+ * Remove all mounts for a user and storage
+ *
+ * @param $storageId
+ * @param string $userId
+ * @return mixed
+ * @since 9.0.0
+ */
+ public function removeUserStorageMount($storageId, $userId);
+
+ /**
+ * Remove all cached mounts for a storage
+ *
+ * @param $storageId
+ * @return mixed
+ * @since 9.0.0
+ */
+ public function remoteStorageMounts($storageId);
+}