1
0

IFileAccess.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Files\Cache;
  8. /**
  9. * Low level access to the file cache.
  10. *
  11. * This is intended for use cases where data from the filecache needs to be loaded, but the full filesystem apis are
  12. * insufficient or too inefficient for the use-case.
  13. *
  14. * @since 29.0.0
  15. */
  16. interface IFileAccess {
  17. /**
  18. * Get a filecache data by file id from a specific storage.
  19. *
  20. * This is preferred over `getByFileId` when the storage id is known as it
  21. * can be more efficient in some setups.
  22. *
  23. * @param int $fileId
  24. * @param int $storageId
  25. * @return ICacheEntry|null
  26. *
  27. * @since 29.0.0
  28. */
  29. public function getByFileIdInStorage(int $fileId, int $storageId): ?ICacheEntry;
  30. /**
  31. * Get a filecache data by path and storage id.
  32. *
  33. * @param string $path
  34. * @param int $storageId
  35. * @return ICacheEntry|null
  36. *
  37. * @since 29.0.0
  38. */
  39. public function getByPathInStorage(string $path, int $storageId): ?ICacheEntry;
  40. /**
  41. * Get a filecache data by file id.
  42. *
  43. * If the storage id is known then `getByFileIdInStorage` is preferred as it can be more efficient in some setups.
  44. *
  45. * @param int $fileId
  46. * @return ICacheEntry|null
  47. *
  48. * @since 29.0.0
  49. */
  50. public function getByFileId(int $fileId): ?ICacheEntry;
  51. /**
  52. * Get filecache data by file ids.
  53. *
  54. * If the storage id is known then `getByFileIdsInStorage` is preferred as it can be more efficient in some setups.
  55. *
  56. * @param int[] $fileIds
  57. * @return array<int, ICacheEntry>
  58. *
  59. * @since 29.0.0
  60. */
  61. public function getByFileIds(array $fileIds): array;
  62. /**
  63. * Get filecache data by file ids from a specific storage.
  64. *
  65. * This is prefered over `getByFileIds` when the storage id is known as it
  66. * can be more efficient in some setups.
  67. *
  68. * @param int[] $fileIds
  69. * @param int $storageId
  70. * @return array<int, ICacheEntry>
  71. *
  72. * @since 29.0.0
  73. */
  74. public function getByFileIdsInStorage(array $fileIds, int $storageId): array;
  75. }