IObjectStore.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCP\Files\ObjectStore;
  8. use OCP\Files\NotFoundException;
  9. /**
  10. * Interface IObjectStore
  11. *
  12. * @since 7.0.0
  13. */
  14. interface IObjectStore {
  15. /**
  16. * @return string the container or bucket name where objects are stored
  17. * @since 7.0.0
  18. */
  19. public function getStorageId();
  20. /**
  21. * @param string $urn the unified resource name used to identify the object
  22. * @return resource stream with the read data
  23. * @throws \Exception when something goes wrong, message will be logged
  24. * @throws NotFoundException if file does not exist
  25. * @since 7.0.0
  26. */
  27. public function readObject($urn);
  28. /**
  29. * @param string $urn the unified resource name used to identify the object
  30. * @param resource $stream stream with the data to write
  31. * @param string|null $mimetype the mimetype to set for the remove object @since 22.0.0
  32. * @throws \Exception when something goes wrong, message will be logged
  33. * @since 7.0.0
  34. */
  35. public function writeObject($urn, $stream, ?string $mimetype = null);
  36. /**
  37. * @param string $urn the unified resource name used to identify the object
  38. * @return void
  39. * @throws \Exception when something goes wrong, message will be logged
  40. * @since 7.0.0
  41. */
  42. public function deleteObject($urn);
  43. /**
  44. * Check if an object exists in the object store
  45. *
  46. * @param string $urn
  47. * @return bool
  48. * @since 16.0.0
  49. */
  50. public function objectExists($urn);
  51. /**
  52. * @param string $from the unified resource name used to identify the source object
  53. * @param string $to the unified resource name used to identify the target object
  54. * @return void
  55. * @since 21.0.0
  56. */
  57. public function copyObject($from, $to);
  58. }