ICacheEntry.php 3.9 KB

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