IUpdater.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCP\Files\Cache;
  8. use OCP\Files\Storage\IStorage;
  9. /**
  10. * Update the cache and propagate changes
  11. *
  12. * @since 9.0.0
  13. */
  14. interface IUpdater {
  15. /**
  16. * Get the propagator for etags and mtime for the view the updater works on
  17. *
  18. * @return IPropagator
  19. * @since 9.0.0
  20. */
  21. public function getPropagator();
  22. /**
  23. * Propagate etag and mtime changes for the parent folders of $path up to the root of the filesystem
  24. *
  25. * @param string $path the path of the file to propagate the changes for
  26. * @param int|null $time the timestamp to set as mtime for the parent folders, if left out the current time is used
  27. * @since 9.0.0
  28. */
  29. public function propagate($path, $time = null);
  30. /**
  31. * Update the cache for $path and update the size, etag and mtime of the parent folders
  32. *
  33. * @param string $path
  34. * @param int $time
  35. * @since 9.0.0
  36. */
  37. public function update($path, $time = null, ?int $sizeDifference = null);
  38. /**
  39. * Remove $path from the cache and update the size, etag and mtime of the parent folders
  40. *
  41. * @param string $path
  42. * @since 9.0.0
  43. */
  44. public function remove($path);
  45. /**
  46. * Rename a file or folder in the cache and update the size, etag and mtime of the parent folders
  47. *
  48. * @param IStorage $sourceStorage
  49. * @param string $source
  50. * @param string $target
  51. * @since 9.0.0
  52. */
  53. public function renameFromStorage(IStorage $sourceStorage, $source, $target);
  54. /**
  55. * Copy a file or folder in the cache and update the size, etag and mtime of the parent folders
  56. *
  57. * @since 31.0.0
  58. */
  59. public function copyFromStorage(IStorage $sourceStorage, string $source, string $target): void;
  60. }