1
0

ICacheEntry.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  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\Cache;
  24. use ArrayAccess;
  25. /**
  26. * meta data for a file or folder
  27. *
  28. * @since 9.0.0
  29. * @template-extends ArrayAccess<string,mixed>
  30. *
  31. * This interface extends \ArrayAccess since v21.0.0, previous versions only
  32. * implemented it in the private implementation. Hence php would allow using the
  33. * object as array, while strictly speaking it didn't support this.
  34. */
  35. interface ICacheEntry extends ArrayAccess {
  36. /**
  37. * @since 9.0.0
  38. */
  39. public const DIRECTORY_MIMETYPE = 'httpd/unix-directory';
  40. /**
  41. * Get the numeric id of a file
  42. *
  43. * @return int
  44. * @since 9.0.0
  45. */
  46. public function getId();
  47. /**
  48. * Get the numeric id for the storage
  49. *
  50. * @return int
  51. * @since 9.0.0
  52. */
  53. public function getStorageId();
  54. /**
  55. * Get the path of the file relative to the storage root
  56. *
  57. * @return string
  58. * @since 9.0.0
  59. */
  60. public function getPath();
  61. /**
  62. * Get the file name
  63. *
  64. * @return string
  65. * @since 9.0.0
  66. */
  67. public function getName();
  68. /**
  69. * Get the full mimetype
  70. *
  71. * @return string
  72. * @since 9.0.0
  73. */
  74. public function getMimeType();
  75. /**
  76. * Get the first part of the mimetype
  77. *
  78. * @return string
  79. * @since 9.0.0
  80. */
  81. public function getMimePart();
  82. /**
  83. * Get the file size in bytes
  84. *
  85. * @return int
  86. * @since 9.0.0
  87. */
  88. public function getSize();
  89. /**
  90. * Get the last modified date as unix timestamp
  91. *
  92. * @return int
  93. * @since 9.0.0
  94. */
  95. public function getMTime();
  96. /**
  97. * Get the last modified date on the storage as unix timestamp
  98. *
  99. * 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
  100. * This can differ from the mtime on the underlying storage which usually only changes when a direct child is added, removed or renamed
  101. *
  102. * @return int
  103. * @since 9.0.0
  104. */
  105. public function getStorageMTime();
  106. /**
  107. * Get the etag for the file
  108. *
  109. * An etag is used for change detection of files and folders, an etag of a file changes whenever the content of the file changes
  110. * Etag for folders change whenever a file in the folder has changed
  111. *
  112. * @return string
  113. * @since 9.0.0
  114. */
  115. public function getEtag();
  116. /**
  117. * Get the permissions for the file stored as bitwise combination of \OCP\Constants::PERMISSION_READ, \OCP\Constants::PERMISSION_CREATE
  118. * \OCP\Constants::PERMISSION_UPDATE, \OCP\Constants::PERMISSION_DELETE and \OCP\Constants::PERMISSION_SHARE
  119. *
  120. * @return int
  121. * @since 9.0.0
  122. */
  123. public function getPermissions();
  124. /**
  125. * Check if the file is encrypted
  126. *
  127. * @return bool
  128. * @since 9.0.0
  129. */
  130. public function isEncrypted();
  131. /**
  132. * Get the metadata etag for the file
  133. *
  134. * @return string | null
  135. * @since 18.0.0
  136. */
  137. public function getMetadataEtag(): ?string;
  138. /**
  139. * Get the last modified date as unix timestamp
  140. *
  141. * @return int | null
  142. * @since 18.0.0
  143. */
  144. public function getCreationTime(): ?int;
  145. /**
  146. * Get the last modified date as unix timestamp
  147. *
  148. * @return int | null
  149. * @since 18.0.0
  150. */
  151. public function getUploadTime(): ?int;
  152. /**
  153. * Get the unencrypted size
  154. *
  155. * This might be different from the result of getSize
  156. *
  157. * @return int
  158. * @since 25.0.0
  159. */
  160. public function getUnencryptedSize(): int;
  161. }