IObjectStore.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 Roeland Jago Douma <roeland@famdouma.nl>
  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 OCP\Files\ObjectStore;
  25. use OCP\Files\NotFoundException;
  26. /**
  27. * Interface IObjectStore
  28. *
  29. * @package OCP\Files\ObjectStore
  30. * @since 7.0.0
  31. */
  32. interface IObjectStore {
  33. /**
  34. * @return string the container or bucket name where objects are stored
  35. * @since 7.0.0
  36. */
  37. public function getStorageId();
  38. /**
  39. * @param string $urn the unified resource name used to identify the object
  40. * @return resource stream with the read data
  41. * @throws \Exception when something goes wrong, message will be logged
  42. * @throws NotFoundException if file does not exist
  43. * @since 7.0.0
  44. */
  45. public function readObject($urn);
  46. /**
  47. * @param string $urn the unified resource name used to identify the object
  48. * @param resource $stream stream with the data to write
  49. * @throws \Exception when something goes wrong, message will be logged
  50. * @since 7.0.0
  51. */
  52. public function writeObject($urn, $stream);
  53. /**
  54. * @param string $urn the unified resource name used to identify the object
  55. * @return void
  56. * @throws \Exception when something goes wrong, message will be logged
  57. * @since 7.0.0
  58. */
  59. public function deleteObject($urn);
  60. /**
  61. * Check if an object exists in the object store
  62. *
  63. * @param string $urn
  64. * @return bool
  65. * @since 15.0.1
  66. */
  67. public function objectExists($urn);
  68. }