IStorageFactory.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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\Storage;
  8. use OCP\Files\Mount\IMountPoint;
  9. /**
  10. * Creates storage instances and manages and applies storage wrappers
  11. * @since 8.0.0
  12. */
  13. interface IStorageFactory {
  14. /**
  15. * allow modifier storage behaviour by adding wrappers around storages
  16. *
  17. * $callback should be a function of type (string $mountPoint, Storage $storage) => Storage
  18. *
  19. * @param string $wrapperName
  20. * @param callable $callback
  21. * @return bool true if the wrapper was added, false if there was already a wrapper with this
  22. * name registered
  23. * @since 8.0.0
  24. */
  25. public function addStorageWrapper($wrapperName, $callback);
  26. /**
  27. * @param \OCP\Files\Mount\IMountPoint $mountPoint
  28. * @param string $class
  29. * @param array $arguments
  30. * @return \OCP\Files\Storage
  31. * @since 8.0.0
  32. */
  33. public function getInstance(IMountPoint $mountPoint, $class, $arguments);
  34. }