You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
3.0 KiB

3 years ago
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Julius Härtl <jus@bitgrid.net>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Robin Appelman <robin@icewind.nl>
  8. *
  9. * @license AGPL-3.0
  10. *
  11. * This code is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License, version 3,
  13. * as published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License, version 3,
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>
  22. *
  23. */
  24. namespace OCP\Files\Config;
  25. use OCP\Files\Mount\IMountPoint;
  26. use OCP\IUser;
  27. /**
  28. * Cache mounts points per user in the cache so we can easily look them up
  29. *
  30. * @since 9.0.0
  31. */
  32. interface IUserMountCache {
  33. /**
  34. * Register mounts for a user to the cache
  35. *
  36. * @param IUser $user
  37. * @param IMountPoint[] $mounts
  38. * @since 9.0.0
  39. */
  40. public function registerMounts(IUser $user, array $mounts);
  41. /**
  42. * Get all cached mounts for a user
  43. *
  44. * @param IUser $user
  45. * @return ICachedMountInfo[]
  46. * @since 9.0.0
  47. */
  48. public function getMountsForUser(IUser $user);
  49. /**
  50. * Get all cached mounts by storage
  51. *
  52. * @param int $numericStorageId
  53. * @param string|null $user limit the results to a single user @since 12.0.0
  54. * @return ICachedMountInfo[]
  55. * @since 9.0.0
  56. */
  57. public function getMountsForStorageId($numericStorageId, $user = null);
  58. /**
  59. * Get all cached mounts by root
  60. *
  61. * @param int $rootFileId
  62. * @return ICachedMountInfo[]
  63. * @since 9.0.0
  64. */
  65. public function getMountsForRootId($rootFileId);
  66. /**
  67. * Get all cached mounts that contain a file
  68. *
  69. * @param int $fileId
  70. * @param string|null $user optionally restrict the results to a single user @since 12.0.0
  71. * @return ICachedMountFileInfo[]
  72. * @since 9.0.0
  73. */
  74. public function getMountsForFileId($fileId, $user = null);
  75. /**
  76. * Remove all cached mounts for a user
  77. *
  78. * @param IUser $user
  79. * @since 9.0.0
  80. */
  81. public function removeUserMounts(IUser $user);
  82. /**
  83. * Remove all mounts for a user and storage
  84. *
  85. * @param $storageId
  86. * @param string $userId
  87. * @return mixed
  88. * @since 9.0.0
  89. */
  90. public function removeUserStorageMount($storageId, $userId);
  91. /**
  92. * Remove all cached mounts for a storage
  93. *
  94. * @param $storageId
  95. * @return mixed
  96. * @since 9.0.0
  97. */
  98. public function remoteStorageMounts($storageId);
  99. /**
  100. * Get the used space for users
  101. *
  102. * Note that this only includes the space in their home directory,
  103. * not any incoming shares or external storages.
  104. *
  105. * @param IUser[] $users
  106. * @return int[] [$userId => $userSpace]
  107. * @since 13.0.0
  108. */
  109. public function getUsedSpaceForUsers(array $users);
  110. /**
  111. * Clear all entries from the in-memory cache
  112. *
  113. * @since 20.0.0
  114. */
  115. public function clear(): void;
  116. }