1
0

ILockManager.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Files\Lock;
  8. use OCP\PreConditionNotMetException;
  9. /**
  10. * Manage app integrations with files_lock with collaborative editors
  11. *
  12. * The OCP parts are mainly for exposing the ability to lock/unlock for apps and
  13. * to give the files_lock app a way to register and then be triggered by the apps
  14. * while the actual locking implementation is kept in the LockProvider and DAV
  15. * plugin from files_lock app.
  16. *
  17. * @since 24.0.0
  18. */
  19. interface ILockManager extends ILockProvider {
  20. /**
  21. * @throws PreConditionNotMetException if there is already a lock provider registered
  22. * @since 24.0.0
  23. * @deprecated 30.0.0 Use registerLazyLockProvider
  24. */
  25. public function registerLockProvider(ILockProvider $lockProvider): void;
  26. /**
  27. * @param string $lockProviderClass
  28. * @return void
  29. * @since 30.0.0
  30. */
  31. public function registerLazyLockProvider(string $lockProviderClass): void;
  32. /**
  33. * @return bool
  34. * @since 24.0.0
  35. */
  36. public function isLockProviderAvailable(): bool;
  37. /**
  38. * Run within the scope of a given lock condition
  39. *
  40. * The callback will also be executed if no lock provider is present
  41. *
  42. * @since 24.0.0
  43. */
  44. public function runInScope(LockContext $lock, callable $callback): void;
  45. /**
  46. * @throws NoLockProviderException if there is no lock provider available
  47. * @since 24.0.0
  48. */
  49. public function getLockInScope(): ?LockContext;
  50. }