IUserMountCache.php 2.9 KB

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