istoragefactory.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * @author Morris Jobke <hey@morrisjobke.de>
  4. * @author Robin Appelman <icewind@owncloud.com>
  5. * @author Vincent Petry <pvince81@owncloud.com>
  6. *
  7. * @copyright Copyright (c) 2015, ownCloud, Inc.
  8. * @license AGPL-3.0
  9. *
  10. * This code is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License, version 3,
  12. * as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License, version 3,
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>
  21. *
  22. */
  23. namespace OCP\Files\Storage;
  24. use OCP\Files\Mount\IMountPoint;
  25. /**
  26. * Creates storage instances and manages and applies storage wrappers
  27. * @since 8.0.0
  28. */
  29. interface IStorageFactory {
  30. /**
  31. * allow modifier storage behaviour by adding wrappers around storages
  32. *
  33. * $callback should be a function of type (string $mountPoint, Storage $storage) => Storage
  34. *
  35. * @param string $wrapperName
  36. * @param callable $callback
  37. * @return bool true if the wrapper was added, false if there was already a wrapper with this
  38. * name registered
  39. * @since 8.0.0
  40. */
  41. public function addStorageWrapper($wrapperName, $callback);
  42. /**
  43. * @param \OCP\Files\Mount\IMountPoint $mountPoint
  44. * @param string $class
  45. * @param array $arguments
  46. * @return \OCP\Files\Storage
  47. * @since 8.0.0
  48. */
  49. public function getInstance(IMountPoint $mountPoint, $class, $arguments);
  50. }