Storage.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Morris Jobke <hey@morrisjobke.de>
  6. * @author Robin Appelman <robin@icewind.nl>
  7. * @author Thomas Müller <thomas.mueller@tmit.eu>
  8. *
  9. * @license AGPL-3.0
  10. *
  11. * This code is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License, version 3,
  13. * as published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License, version 3,
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>
  22. *
  23. */
  24. namespace OC\Files\Storage;
  25. use OCP\Lock\ILockingProvider;
  26. /**
  27. * Provide a common interface to all different storage options
  28. *
  29. * All paths passed to the storage are relative to the storage and should NOT have a leading slash.
  30. */
  31. interface Storage extends \OCP\Files\Storage {
  32. /**
  33. * get a cache instance for the storage
  34. *
  35. * @param string $path
  36. * @param \OC\Files\Storage\Storage (optional) the storage to pass to the cache
  37. * @return \OC\Files\Cache\Cache
  38. */
  39. public function getCache($path = '', $storage = null);
  40. /**
  41. * get a scanner instance for the storage
  42. *
  43. * @param string $path
  44. * @param \OC\Files\Storage\Storage (optional) the storage to pass to the scanner
  45. * @return \OC\Files\Cache\Scanner
  46. */
  47. public function getScanner($path = '', $storage = null);
  48. /**
  49. * get the user id of the owner of a file or folder
  50. *
  51. * @param string $path
  52. * @return string
  53. */
  54. public function getOwner($path);
  55. /**
  56. * get a watcher instance for the cache
  57. *
  58. * @param string $path
  59. * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher
  60. * @return \OC\Files\Cache\Watcher
  61. */
  62. public function getWatcher($path = '', $storage = null);
  63. /**
  64. * get a propagator instance for the cache
  65. *
  66. * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher
  67. * @return \OC\Files\Cache\Propagator
  68. */
  69. public function getPropagator($storage = null);
  70. /**
  71. * get a updater instance for the cache
  72. *
  73. * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher
  74. * @return \OC\Files\Cache\Updater
  75. */
  76. public function getUpdater($storage = null);
  77. /**
  78. * @return \OC\Files\Cache\Storage
  79. */
  80. public function getStorageCache();
  81. /**
  82. * @param string $path
  83. * @return array
  84. */
  85. public function getMetaData($path);
  86. /**
  87. * @param string $path The path of the file to acquire the lock for
  88. * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
  89. * @param \OCP\Lock\ILockingProvider $provider
  90. * @throws \OCP\Lock\LockedException
  91. */
  92. public function acquireLock($path, $type, ILockingProvider $provider);
  93. /**
  94. * @param string $path The path of the file to release the lock for
  95. * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
  96. * @param \OCP\Lock\ILockingProvider $provider
  97. */
  98. public function releaseLock($path, $type, ILockingProvider $provider);
  99. /**
  100. * @param string $path The path of the file to change the lock for
  101. * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
  102. * @param \OCP\Lock\ILockingProvider $provider
  103. * @throws \OCP\Lock\LockedException
  104. */
  105. public function changeLock($path, $type, ILockingProvider $provider);
  106. }