IObjectStore.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Robin Appelman <robin@icewind.nl>
  8. * @author Roeland Jago Douma <roeland@famdouma.nl>
  9. *
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. namespace OCP\Files\ObjectStore;
  26. use OCP\Files\NotFoundException;
  27. /**
  28. * Interface IObjectStore
  29. *
  30. * @package OCP\Files\ObjectStore
  31. * @since 7.0.0
  32. */
  33. interface IObjectStore {
  34. /**
  35. * @return string the container or bucket name where objects are stored
  36. * @since 7.0.0
  37. */
  38. public function getStorageId();
  39. /**
  40. * @param string $urn the unified resource name used to identify the object
  41. * @return resource stream with the read data
  42. * @throws \Exception when something goes wrong, message will be logged
  43. * @throws NotFoundException if file does not exist
  44. * @since 7.0.0
  45. */
  46. public function readObject($urn);
  47. /**
  48. * @param string $urn the unified resource name used to identify the object
  49. * @param resource $stream stream with the data to write
  50. * @throws \Exception when something goes wrong, message will be logged
  51. * @since 7.0.0
  52. */
  53. public function writeObject($urn, $stream);
  54. /**
  55. * @param string $urn the unified resource name used to identify the object
  56. * @return void
  57. * @throws \Exception when something goes wrong, message will be logged
  58. * @since 7.0.0
  59. */
  60. public function deleteObject($urn);
  61. /**
  62. * Check if an object exists in the object store
  63. *
  64. * @param string $urn
  65. * @return bool
  66. * @since 16.0.0
  67. */
  68. public function objectExists($urn);
  69. }