ICacheEntry.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Robin Appelman <robin@icewind.nl>
  6. *
  7. * @license AGPL-3.0
  8. *
  9. * This code is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License, version 3,
  11. * as published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License, version 3,
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>
  20. *
  21. */
  22. namespace OCP\Files\Cache;
  23. /**
  24. * meta data for a file or folder
  25. *
  26. * @since 9.0.0
  27. */
  28. interface ICacheEntry {
  29. const DIRECTORY_MIMETYPE = 'httpd/unix-directory';
  30. /**
  31. * Get the numeric id of a file
  32. *
  33. * @return int
  34. * @since 9.0.0
  35. */
  36. public function getId();
  37. /**
  38. * Get the numeric id for the storage
  39. *
  40. * @return int
  41. * @since 9.0.0
  42. */
  43. public function getStorageId();
  44. /**
  45. * Get the path of the file relative to the storage root
  46. *
  47. * @return string
  48. * @since 9.0.0
  49. */
  50. public function getPath();
  51. /**
  52. * Get the file name
  53. *
  54. * @return string
  55. * @since 9.0.0
  56. */
  57. public function getName();
  58. /**
  59. * Get the full mimetype
  60. *
  61. * @return string
  62. * @since 9.0.0
  63. */
  64. public function getMimeType();
  65. /**
  66. * Get the first part of the mimetype
  67. *
  68. * @return string
  69. * @since 9.0.0
  70. */
  71. public function getMimePart();
  72. /**
  73. * Get the file size in bytes
  74. *
  75. * @return int
  76. * @since 9.0.0
  77. */
  78. public function getSize();
  79. /**
  80. * Get the last modified date as unix timestamp
  81. *
  82. * @return int
  83. * @since 9.0.0
  84. */
  85. public function getMTime();
  86. /**
  87. * Get the last modified date on the storage as unix timestamp
  88. *
  89. * 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
  90. * This can differ from the mtime on the underlying storage which usually only changes when a direct child is added, removed or renamed
  91. *
  92. * @return int
  93. * @since 9.0.0
  94. */
  95. public function getStorageMTime();
  96. /**
  97. * Get the etag for the file
  98. *
  99. * An etag is used for change detection of files and folders, an etag of a file changes whenever the content of the file changes
  100. * Etag for folders change whenever a file in the folder has changed
  101. *
  102. * @return string
  103. * @since 9.0.0
  104. */
  105. public function getEtag();
  106. /**
  107. * Get the permissions for the file stored as bitwise combination of \OCP\PERMISSION_READ, \OCP\PERMISSION_CREATE
  108. * \OCP\PERMISSION_UPDATE, \OCP\PERMISSION_DELETE and \OCP\PERMISSION_SHARE
  109. *
  110. * @return int
  111. * @since 9.0.0
  112. */
  113. public function getPermissions();
  114. /**
  115. * Check if the file is encrypted
  116. *
  117. * @return bool
  118. * @since 9.0.0
  119. */
  120. public function isEncrypted();
  121. }