IObjectStore.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. * @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. * @param string|null $mimetype the mimetype to set for the remove object @since 22.0.0
  50. * @throws \Exception when something goes wrong, message will be logged
  51. * @since 7.0.0
  52. */
  53. public function writeObject($urn, $stream, string $mimetype = null);
  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. /**
  70. * @param string $from the unified resource name used to identify the source object
  71. * @param string $to the unified resource name used to identify the target object
  72. * @return void
  73. * @since 21.0.0
  74. */
  75. public function copyObject($from, $to);
  76. }