Adapter.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?php
  2. /**
  3. * LICENSE
  4. *
  5. * This source file is subject to the new BSD license that is bundled
  6. * with this package in the file LICENSE.txt.
  7. * It is also available through the world-wide-web at this URL:
  8. * http://framework.zend.com/license/new-bsd
  9. * If you did not receive a copy of the license and are unable to
  10. * obtain it through the world-wide-web, please send an email
  11. * to license@zend.com so we can send you a copy immediately.
  12. *
  13. * @category Zend
  14. * @package Zend_Cloud
  15. * @subpackage StorageService
  16. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  17. * @license http://framework.zend.com/license/new-bsd New BSD License
  18. */
  19. /**
  20. * Common interface for unstructured cloud storage.
  21. *
  22. * @category Zend
  23. * @package Zend_Cloud
  24. * @subpackage StorageService
  25. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  26. * @license http://framework.zend.com/license/new-bsd New BSD License
  27. */
  28. interface Zend_Cloud_StorageService_Adapter
  29. {
  30. // HTTP adapter to use for connections
  31. const HTTP_ADAPTER = 'http_adapter';
  32. /**
  33. * Get an item from the storage service.
  34. *
  35. * @param string $path
  36. * @param array $options
  37. * @return mixed
  38. */
  39. public function fetchItem($path, $options = null);
  40. /**
  41. * Store an item in the storage service.
  42. * WARNING: This operation overwrites any item that is located at
  43. * $destinationPath.
  44. * @param string $destinationPath
  45. * @param mixed $data
  46. * @param array $options
  47. * @return boolean
  48. */
  49. public function storeItem($destinationPath,
  50. $data,
  51. $options = null);
  52. /**
  53. * Delete an item in the storage service.
  54. *
  55. * @param string $path
  56. * @param array $options
  57. * @return void
  58. */
  59. public function deleteItem($path, $options = null);
  60. /**
  61. * Copy an item in the storage service to a given path.
  62. *
  63. * The $destinationPath must be a directory.
  64. *
  65. * @param string $sourcePath
  66. * @param string $destination path
  67. * @param array $options
  68. * @return void
  69. */
  70. public function copyItem($sourcePath, $destinationPath, $options = null);
  71. /**
  72. * Move an item in the storage service to a given path.
  73. *
  74. * The $destinationPath must be a directory.
  75. *
  76. * @param string $sourcePath
  77. * @param string $destination path
  78. * @param array $options
  79. * @return void
  80. */
  81. public function moveItem($sourcePath, $destinationPath, $options = null);
  82. /**
  83. * Rename an item in the storage service to a given name.
  84. *
  85. *
  86. * @param string $path
  87. * @param string $name
  88. * @param array $options
  89. * @return void
  90. */
  91. public function renameItem($path, $name, $options = null);
  92. /**
  93. * List items in the given directory in the storage service
  94. *
  95. * The $path must be a directory
  96. *
  97. *
  98. * @param string $path Must be a directory
  99. * @param array $options
  100. * @return array A list of item names
  101. */
  102. public function listItems($path, $options = null);
  103. /**
  104. * Get a key/value array of metadata for the given path.
  105. *
  106. * @param string $path
  107. * @param array $options
  108. * @return array
  109. */
  110. public function fetchMetadata($path, $options = null);
  111. /**
  112. * Store a key/value array of metadata at the given path.
  113. * WARNING: This operation overwrites any metadata that is located at
  114. * $destinationPath.
  115. *
  116. * @param string $destinationPath
  117. * @param array $options
  118. * @return void
  119. */
  120. public function storeMetadata($destinationPath, $metadata, $options = null);
  121. /**
  122. * Delete a key/value array of metadata at the given path.
  123. *
  124. * @param string $path
  125. * @param array $options
  126. * @return void
  127. */
  128. public function deleteMetadata($path);
  129. /**
  130. * Get the concrete client.
  131. */
  132. public function getClient();
  133. }