IMountManager.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  6. * SPDX-License-Identifier: AGPL-3.0-only
  7. */
  8. namespace OCP\Files\Mount;
  9. use OCP\Files\Config\ICachedMountInfo;
  10. /**
  11. * Interface IMountManager
  12. *
  13. * Manages all mounted storages in the system
  14. * @since 8.2.0
  15. */
  16. interface IMountManager {
  17. /**
  18. * Add a new mount
  19. *
  20. * @param IMountPoint $mount
  21. * @since 8.2.0
  22. */
  23. public function addMount(IMountPoint $mount);
  24. /**
  25. * Remove a mount
  26. *
  27. * @param string $mountPoint
  28. * @since 8.2.0
  29. */
  30. public function removeMount(string $mountPoint);
  31. /**
  32. * Change the location of a mount
  33. *
  34. * @param string $mountPoint
  35. * @param string $target
  36. * @since 8.2.0
  37. */
  38. public function moveMount(string $mountPoint, string $target);
  39. /**
  40. * Find the mount for $path
  41. *
  42. * @param string $path
  43. * @return IMountPoint
  44. * @since 8.2.0
  45. */
  46. public function find(string $path): ?IMountPoint;
  47. /**
  48. * Find all mounts in $path
  49. *
  50. * @param string $path
  51. * @return IMountPoint[]
  52. * @since 8.2.0
  53. */
  54. public function findIn(string $path): array;
  55. /**
  56. * Remove all registered mounts
  57. *
  58. * @since 8.2.0
  59. */
  60. public function clear();
  61. /**
  62. * Find mounts by storage id
  63. *
  64. * @param string $id
  65. * @return IMountPoint[]
  66. * @since 8.2.0
  67. */
  68. public function findByStorageId(string $id): array;
  69. /**
  70. * @return IMountPoint[]
  71. * @since 8.2.0
  72. */
  73. public function getAll(): array;
  74. /**
  75. * Find mounts by numeric storage id
  76. *
  77. * @param int $id
  78. * @return IMountPoint[]
  79. * @since 8.2.0
  80. */
  81. public function findByNumericId(int $id): array;
  82. /**
  83. * Return the mount matching a cached mount info (or mount file info)
  84. *
  85. * @param ICachedMountInfo $info
  86. *
  87. * @return IMountPoint|null
  88. * @since 28.0.0
  89. */
  90. public function getMountFromMountInfo(ICachedMountInfo $info): ?IMountPoint;
  91. }