You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

160 lines
3.4 KiB

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