1
0

ICacheEntry.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCP\Files\Cache;
  8. use ArrayAccess;
  9. /**
  10. * meta data for a file or folder
  11. *
  12. * @since 9.0.0
  13. * @template-extends ArrayAccess<string,mixed>
  14. *
  15. * This interface extends \ArrayAccess since v21.0.0, previous versions only
  16. * implemented it in the private implementation. Hence php would allow using the
  17. * object as array, while strictly speaking it didn't support this.
  18. */
  19. interface ICacheEntry extends ArrayAccess {
  20. /**
  21. * @since 9.0.0
  22. */
  23. public const DIRECTORY_MIMETYPE = 'httpd/unix-directory';
  24. /**
  25. * Get the numeric id of a file
  26. *
  27. * @return int
  28. * @since 9.0.0
  29. */
  30. public function getId();
  31. /**
  32. * Get the numeric id for the storage
  33. *
  34. * @return int
  35. * @since 9.0.0
  36. */
  37. public function getStorageId();
  38. /**
  39. * Get the path of the file relative to the storage root
  40. *
  41. * @return string
  42. * @since 9.0.0
  43. */
  44. public function getPath();
  45. /**
  46. * Get the file name
  47. *
  48. * @return string
  49. * @since 9.0.0
  50. */
  51. public function getName();
  52. /**
  53. * Get the full mimetype
  54. *
  55. * @return string
  56. * @since 9.0.0
  57. */
  58. public function getMimeType();
  59. /**
  60. * Get the first part of the mimetype
  61. *
  62. * @return string
  63. * @since 9.0.0
  64. */
  65. public function getMimePart();
  66. /**
  67. * Get the file size in bytes
  68. *
  69. * @return int
  70. * @since 9.0.0
  71. */
  72. public function getSize();
  73. /**
  74. * Get the last modified date as unix timestamp
  75. *
  76. * @return int
  77. * @since 9.0.0
  78. */
  79. public function getMTime();
  80. /**
  81. * Get the last modified date on the storage as unix timestamp
  82. *
  83. * Note that when a file is updated we also update the mtime of all parent folders to make it visible to the user which folder has had updates most recently
  84. * This can differ from the mtime on the underlying storage which usually only changes when a direct child is added, removed or renamed
  85. *
  86. * @return int
  87. * @since 9.0.0
  88. */
  89. public function getStorageMTime();
  90. /**
  91. * Get the etag for the file
  92. *
  93. * An etag is used for change detection of files and folders, an etag of a file changes whenever the content of the file changes
  94. * Etag for folders change whenever a file in the folder has changed
  95. *
  96. * @return string
  97. * @since 9.0.0
  98. */
  99. public function getEtag();
  100. /**
  101. * Get the permissions for the file stored as bitwise combination of \OCP\Constants::PERMISSION_READ, \OCP\Constants::PERMISSION_CREATE
  102. * \OCP\Constants::PERMISSION_UPDATE, \OCP\Constants::PERMISSION_DELETE and \OCP\Constants::PERMISSION_SHARE
  103. *
  104. * @return int
  105. * @since 9.0.0
  106. */
  107. public function getPermissions();
  108. /**
  109. * Check if the file is encrypted
  110. *
  111. * @return bool
  112. * @since 9.0.0
  113. */
  114. public function isEncrypted();
  115. /**
  116. * Get the metadata etag for the file
  117. *
  118. * @return string | null
  119. * @since 18.0.0
  120. */
  121. public function getMetadataEtag(): ?string;
  122. /**
  123. * Get the last modified date as unix timestamp
  124. *
  125. * @return int | null
  126. * @since 18.0.0
  127. */
  128. public function getCreationTime(): ?int;
  129. /**
  130. * Get the last modified date as unix timestamp
  131. *
  132. * @return int | null
  133. * @since 18.0.0
  134. */
  135. public function getUploadTime(): ?int;
  136. /**
  137. * Get the unencrypted size
  138. *
  139. * This might be different from the result of getSize
  140. *
  141. * @return int
  142. * @since 25.0.0
  143. */
  144. public function getUnencryptedSize(): int;
  145. }