File indexing completed on 2025-01-26 05:24:52
0001 <?php 0002 /** 0003 * LICENSE 0004 * 0005 * This source file is subject to the new BSD license that is bundled 0006 * with this package in the file LICENSE.txt. 0007 * It is also available through the world-wide-web at this URL: 0008 * http://framework.zend.com/license/new-bsd 0009 * If you did not receive a copy of the license and are unable to 0010 * obtain it through the world-wide-web, please send an email 0011 * to license@zend.com so we can send you a copy immediately. 0012 * 0013 * @category Zend 0014 * @package Zend_Cloud 0015 * @subpackage DocumentService 0016 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0017 * @license http://framework.zend.com/license/new-bsd New BSD License 0018 */ 0019 0020 /** 0021 * Common interface for document storage services in the cloud. This interface 0022 * supports most document services and provides some flexibility for 0023 * vendor-specific features and requirements via an optional $options array in 0024 * each method signature. Classes implementing this interface should implement 0025 * URI construction for collections and documents from the parameters given in each 0026 * method and the account data passed in to the constructor. Classes 0027 * implementing this interface are also responsible for security; access control 0028 * isn't currently supported in this interface, although we are considering 0029 * access control support in future versions of the interface. 0030 * 0031 * @category Zend 0032 * @package Zend_Cloud 0033 * @subpackage DocumentService 0034 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0035 * @license http://framework.zend.com/license/new-bsd New BSD License 0036 */ 0037 interface Zend_Cloud_DocumentService_Adapter 0038 { 0039 // HTTP adapter to use for connections 0040 const HTTP_ADAPTER = 'http_adapter'; 0041 0042 /** 0043 * Create collection. 0044 * 0045 * @param string $name 0046 * @param array $options 0047 * @return array 0048 */ 0049 public function createCollection($name, $options = null); 0050 0051 /** 0052 * Delete collection. 0053 * 0054 * @param string $name 0055 * @param array $options 0056 * @return void 0057 */ 0058 public function deleteCollection($name, $options = null); 0059 0060 /** 0061 * List collections. 0062 * 0063 * @param array $options 0064 * @return array List of collection names 0065 */ 0066 public function listCollections($options = null); 0067 0068 /** 0069 * List all documents in a collection 0070 * 0071 * @param string $collectionName 0072 * @param null|array $options 0073 * @return Zend_Cloud_DocumentService_DocumentSet 0074 */ 0075 public function listDocuments($collectionName, array $options = null); 0076 0077 /** 0078 * Insert document 0079 * 0080 * @param string $collectionName Collection name 0081 * @param Zend_Cloud_DocumentService_Document $document Document to insert 0082 * @param array $options 0083 * @return boolean 0084 */ 0085 public function insertDocument($collectionName, $document, $options = null); 0086 0087 /** 0088 * Replace document 0089 * The new document replaces the existing document with the same ID. 0090 * 0091 * @param string $collectionName Collection name 0092 * @param Zend_Cloud_DocumentService_Document $document 0093 * @param array $options 0094 */ 0095 public function replaceDocument($collectionName, $document, $options = null); 0096 0097 /** 0098 * Update document 0099 * The fields of the existing documents will be updated. 0100 * Fields not specified in the set will be left as-is. 0101 * 0102 * @param string $collectionName 0103 * @param mixed|Zend_Cloud_DocumentService_Document $documentID Document ID, adapter-dependent, or document containing updates 0104 * @param array|Zend_Cloud_DocumentService_Document $fieldset Set of fields to update 0105 * @param array $options 0106 * @return boolean 0107 */ 0108 public function updateDocument($collectionName, $documentID, $fieldset = null, $options = null); 0109 0110 /** 0111 * Delete document 0112 * 0113 * @param string $collectionName Collection name 0114 * @param mixed $documentID Document ID, adapter-dependent 0115 * @param array $options 0116 * @return void 0117 */ 0118 public function deleteDocument($collectionName, $documentID, $options = null); 0119 0120 /** 0121 * Fetch single document by ID 0122 * 0123 * Will return false if the document does not exist 0124 * 0125 * @param string $collectionName Collection name 0126 * @param mixed $documentID Document ID, adapter-dependent 0127 * @param array $options 0128 * @return Zend_Cloud_DocumentService_Document 0129 */ 0130 public function fetchDocument($collectionName, $documentID, $options = null); 0131 0132 /** 0133 * Query for documents stored in the document service. If a string is passed in 0134 * $query, the query string will be passed directly to the service. 0135 * 0136 * @param string $collectionName Collection name 0137 * @param string $query 0138 * @param array $options 0139 * @return array Array of field sets 0140 */ 0141 public function query($collectionName, $query, $options = null); 0142 0143 /** 0144 * Create query statement 0145 * 0146 * @param string $fields 0147 * @return Zend_Cloud_DocumentService_Query 0148 */ 0149 public function select($fields = null); 0150 0151 /** 0152 * Get the concrete service client 0153 */ 0154 public function getClient(); 0155 }