IUpdater.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. use OCP\Files\Storage\IStorage;
  24. /**
  25. * Update the cache and propagate changes
  26. *
  27. * @since 9.0.0
  28. */
  29. interface IUpdater {
  30. /**
  31. * Get the propagator for etags and mtime for the view the updater works on
  32. *
  33. * @return IPropagator
  34. * @since 9.0.0
  35. */
  36. public function getPropagator();
  37. /**
  38. * Propagate etag and mtime changes for the parent folders of $path up to the root of the filesystem
  39. *
  40. * @param string $path the path of the file to propagate the changes for
  41. * @param int|null $time the timestamp to set as mtime for the parent folders, if left out the current time is used
  42. * @since 9.0.0
  43. */
  44. public function propagate($path, $time = null);
  45. /**
  46. * Update the cache for $path and update the size, etag and mtime of the parent folders
  47. *
  48. * @param string $path
  49. * @param int $time
  50. * @since 9.0.0
  51. */
  52. public function update($path, $time = null, ?int $sizeDifference = null);
  53. /**
  54. * Remove $path from the cache and update the size, etag and mtime of the parent folders
  55. *
  56. * @param string $path
  57. * @since 9.0.0
  58. */
  59. public function remove($path);
  60. /**
  61. * Rename a file or folder in the cache and update the size, etag and mtime of the parent folders
  62. *
  63. * @param IStorage $sourceStorage
  64. * @param string $source
  65. * @param string $target
  66. * @since 9.0.0
  67. */
  68. public function renameFromStorage(IStorage $sourceStorage, $source, $target);
  69. }