diff options
Diffstat (limited to 'lib/public/Files/Mount')
-rw-r--r-- | lib/public/Files/Mount/IMountManager.php | 103 | ||||
-rw-r--r-- | lib/public/Files/Mount/IMountPoint.php | 122 | ||||
-rw-r--r-- | lib/public/Files/Mount/IMovableMount.php | 32 | ||||
-rw-r--r-- | lib/public/Files/Mount/IShareOwnerlessMount.php | 18 | ||||
-rw-r--r-- | lib/public/Files/Mount/ISystemMountPoint.php | 18 |
5 files changed, 293 insertions, 0 deletions
diff --git a/lib/public/Files/Mount/IMountManager.php b/lib/public/Files/Mount/IMountManager.php new file mode 100644 index 00000000000..43a771c07ce --- /dev/null +++ b/lib/public/Files/Mount/IMountManager.php @@ -0,0 +1,103 @@ +<?php + +declare(strict_types=1); +/** + * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2016 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-only + */ +namespace OCP\Files\Mount; + +use OCP\Files\Config\ICachedMountInfo; + +/** + * Interface IMountManager + * + * Manages all mounted storages in the system + * @since 8.2.0 + */ +interface IMountManager { + /** + * Add a new mount + * + * @param IMountPoint $mount + * @since 8.2.0 + */ + public function addMount(IMountPoint $mount); + + /** + * Remove a mount + * + * @param string $mountPoint + * @since 8.2.0 + */ + public function removeMount(string $mountPoint); + + /** + * Change the location of a mount + * + * @param string $mountPoint + * @param string $target + * @since 8.2.0 + */ + public function moveMount(string $mountPoint, string $target); + + /** + * Find the mount for $path + * + * @param string $path + * @return IMountPoint + * @since 8.2.0 + */ + public function find(string $path): ?IMountPoint; + + /** + * Find all mounts in $path + * + * @param string $path + * @return IMountPoint[] + * @since 8.2.0 + */ + public function findIn(string $path): array; + + /** + * Remove all registered mounts + * + * @since 8.2.0 + */ + public function clear(); + + /** + * Find mounts by storage id + * + * @param string $id + * @return IMountPoint[] + * @since 8.2.0 + */ + public function findByStorageId(string $id): array; + + /** + * @return IMountPoint[] + * @since 8.2.0 + */ + public function getAll(): array; + + /** + * Find mounts by numeric storage id + * + * @param int $id + * @return IMountPoint[] + * @since 8.2.0 + */ + public function findByNumericId(int $id): array; + + /** + * Return the mount matching a cached mount info (or mount file info) + * + * @param ICachedMountInfo $info + * + * @return IMountPoint|null + * @since 28.0.0 + */ + public function getMountFromMountInfo(ICachedMountInfo $info): ?IMountPoint; +} diff --git a/lib/public/Files/Mount/IMountPoint.php b/lib/public/Files/Mount/IMountPoint.php new file mode 100644 index 00000000000..8989a885fda --- /dev/null +++ b/lib/public/Files/Mount/IMountPoint.php @@ -0,0 +1,122 @@ +<?php + +/** + * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2016 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-only + */ +namespace OCP\Files\Mount; + +/** + * A storage mounted to folder on the filesystem + * @since 8.0.0 + */ +interface IMountPoint { + /** + * get complete path to the mount point + * + * @return string + * @since 8.0.0 + */ + public function getMountPoint(); + + /** + * Set the mountpoint + * + * @param string $mountPoint new mount point + * @since 8.0.0 + */ + public function setMountPoint($mountPoint); + + /** + * Get the storage that is mounted + * + * @return \OCP\Files\Storage\IStorage|null + * @since 8.0.0 + */ + public function getStorage(); + + /** + * Get the id of the storages + * + * @return string|null + * @since 8.0.0 + */ + public function getStorageId(); + + /** + * Get the id of the storages + * + * @return int|null + * @since 9.1.0 + */ + public function getNumericStorageId(); + + /** + * Get the path relative to the mountpoint + * + * @param string $path absolute path to a file or folder + * @return string + * @since 8.0.0 + */ + public function getInternalPath($path); + + /** + * Apply a storage wrapper to the mounted storage + * + * @param callable $wrapper + * @since 8.0.0 + */ + public function wrapStorage($wrapper); + + /** + * Get a mount option + * + * @param string $name Name of the mount option to get + * @param mixed $default Default value for the mount option + * @return mixed + * @since 8.0.0 + */ + public function getOption($name, $default); + + /** + * Get all options for the mount + * + * @return array + * @since 8.1.0 + */ + public function getOptions(); + + /** + * Get the file id of the root of the storage + * + * @return int + * @since 9.1.0 + */ + public function getStorageRootId(); + + /** + * Get the id of the configured mount + * + * @return int|null mount id or null if not applicable + * @since 9.1.0 + */ + public function getMountId(); + + /** + * Get the type of mount point, used to distinguish things like shares and external storage + * in the web interface + * + * @return string + * @since 12.0.0 + */ + public function getMountType(); + + /** + * Get the class of the mount provider that this mount originates from + * + * @return string + * @since 24.0.0 + */ + public function getMountProvider(): string; +} diff --git a/lib/public/Files/Mount/IMovableMount.php b/lib/public/Files/Mount/IMovableMount.php new file mode 100644 index 00000000000..dc4df7618c0 --- /dev/null +++ b/lib/public/Files/Mount/IMovableMount.php @@ -0,0 +1,32 @@ +<?php + +declare(strict_types=1); +/** + * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace OCP\Files\Mount; + +/** + * Denotes that the mount point can be (re)moved by the user + * + * @since 28.0.0 + */ +interface IMovableMount { + /** + * Move the mount point to $target + * + * @param string $target the target mount point + * @return bool + * @since 28.0.0 + */ + public function moveMount($target); + + /** + * Remove the mount points + * + * @return bool + * @since 28.0.0 + */ + public function removeMount(); +} diff --git a/lib/public/Files/Mount/IShareOwnerlessMount.php b/lib/public/Files/Mount/IShareOwnerlessMount.php new file mode 100644 index 00000000000..b73ee620859 --- /dev/null +++ b/lib/public/Files/Mount/IShareOwnerlessMount.php @@ -0,0 +1,18 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCP\Files\Mount; + +/** + * Denotes that shares created under this mountpoint will be manageable by everyone with share permission. + * + * @since 31.0.0 + */ +interface IShareOwnerlessMount { +} diff --git a/lib/public/Files/Mount/ISystemMountPoint.php b/lib/public/Files/Mount/ISystemMountPoint.php new file mode 100644 index 00000000000..ae1d51621ea --- /dev/null +++ b/lib/public/Files/Mount/ISystemMountPoint.php @@ -0,0 +1,18 @@ +<?php + +declare(strict_types=1); +/** + * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace OCP\Files\Mount; + +/** + * Mark a mountpoint as containing system data, meaning that the data is not user specific + * + * Example use case is signaling to the encryption wrapper that system-wide keys should be used for a mountpoint + * + * @since 25.0.0 + */ +interface ISystemMountPoint extends IMountPoint { +} |