1
0

IWatcher.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. /**
  9. * check the storage backends for updates and change the cache accordingly
  10. *
  11. * @since 9.0.0
  12. */
  13. interface IWatcher {
  14. /**
  15. * @since 9.0.0
  16. */
  17. public const CHECK_NEVER = 0; // never check the underlying filesystem for updates
  18. /**
  19. * @since 9.0.0
  20. */
  21. public const CHECK_ONCE = 1; // check the underlying filesystem for updates once every request for each file
  22. /**
  23. * @since 9.0.0
  24. */
  25. public const CHECK_ALWAYS = 2; // always check the underlying filesystem for updates
  26. /**
  27. * @param int $policy either IWatcher::CHECK_NEVER, IWatcher::CHECK_ONCE, IWatcher::CHECK_ALWAYS
  28. * @since 9.0.0
  29. */
  30. public function setPolicy($policy);
  31. /**
  32. * @return int either IWatcher::CHECK_NEVER, IWatcher::CHECK_ONCE, IWatcher::CHECK_ALWAYS
  33. * @since 9.0.0
  34. */
  35. public function getPolicy();
  36. /**
  37. * check $path for updates and update if needed
  38. *
  39. * @param string $path
  40. * @param ICacheEntry|null $cachedEntry
  41. * @return boolean true if path was updated
  42. * @since 9.0.0
  43. */
  44. public function checkUpdate($path, $cachedEntry = null);
  45. /**
  46. * Update the cache for changes to $path
  47. *
  48. * @param string $path
  49. * @param ICacheEntry $cachedData
  50. * @since 9.0.0
  51. */
  52. public function update($path, $cachedData);
  53. /**
  54. * Check if the cache for $path needs to be updated
  55. *
  56. * @param string $path
  57. * @param ICacheEntry $cachedData
  58. * @return bool
  59. * @since 9.0.0
  60. */
  61. public function needsUpdate($path, $cachedData);
  62. /**
  63. * remove deleted files in $path from the cache
  64. *
  65. * @param string $path
  66. * @since 9.0.0
  67. */
  68. public function cleanFolder($path);
  69. }