IMountManager.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2016, ownCloud, Inc.
  5. *
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Robin Appelman <robin@icewind.nl>
  8. * @author Roeland Jago Douma <roeland@famdouma.nl>
  9. *
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. namespace OCP\Files\Mount;
  26. use OCP\Files\Config\ICachedMountInfo;
  27. /**
  28. * Interface IMountManager
  29. *
  30. * Manages all mounted storages in the system
  31. * @since 8.2.0
  32. */
  33. interface IMountManager {
  34. /**
  35. * Add a new mount
  36. *
  37. * @param IMountPoint $mount
  38. * @since 8.2.0
  39. */
  40. public function addMount(IMountPoint $mount);
  41. /**
  42. * Remove a mount
  43. *
  44. * @param string $mountPoint
  45. * @since 8.2.0
  46. */
  47. public function removeMount(string $mountPoint);
  48. /**
  49. * Change the location of a mount
  50. *
  51. * @param string $mountPoint
  52. * @param string $target
  53. * @since 8.2.0
  54. */
  55. public function moveMount(string $mountPoint, string $target);
  56. /**
  57. * Find the mount for $path
  58. *
  59. * @param string $path
  60. * @return IMountPoint
  61. * @since 8.2.0
  62. */
  63. public function find(string $path): ?IMountPoint;
  64. /**
  65. * Find all mounts in $path
  66. *
  67. * @param string $path
  68. * @return IMountPoint[]
  69. * @since 8.2.0
  70. */
  71. public function findIn(string $path): array;
  72. /**
  73. * Remove all registered mounts
  74. *
  75. * @since 8.2.0
  76. */
  77. public function clear();
  78. /**
  79. * Find mounts by storage id
  80. *
  81. * @param string $id
  82. * @return IMountPoint[]
  83. * @since 8.2.0
  84. */
  85. public function findByStorageId(string $id): array;
  86. /**
  87. * @return IMountPoint[]
  88. * @since 8.2.0
  89. */
  90. public function getAll(): array;
  91. /**
  92. * Find mounts by numeric storage id
  93. *
  94. * @param int $id
  95. * @return IMountPoint[]
  96. * @since 8.2.0
  97. */
  98. public function findByNumericId(int $id): array;
  99. /**
  100. * Return the mount matching a cached mount info (or mount file info)
  101. *
  102. * @param ICachedMountInfo $info
  103. *
  104. * @return IMountPoint|null
  105. * @since 28.0.0
  106. */
  107. public function getMountFromMountInfo(ICachedMountInfo $info): ?IMountPoint;
  108. }