|
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 DocumentService |
|
16 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
17 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
18 */ |
|
19 |
|
20 /** |
|
21 * Common interface for document storage services in the cloud. This interface |
|
22 * supports most document services and provides some flexibility for |
|
23 * vendor-specific features and requirements via an optional $options array in |
|
24 * each method signature. Classes implementing this interface should implement |
|
25 * URI construction for collections and documents from the parameters given in each |
|
26 * method and the account data passed in to the constructor. Classes |
|
27 * implementing this interface are also responsible for security; access control |
|
28 * isn't currently supported in this interface, although we are considering |
|
29 * access control support in future versions of the interface. |
|
30 * |
|
31 * @category Zend |
|
32 * @package Zend_Cloud |
|
33 * @subpackage DocumentService |
|
34 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
35 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
36 */ |
|
37 interface Zend_Cloud_DocumentService_Adapter |
|
38 { |
|
39 // HTTP adapter to use for connections |
|
40 const HTTP_ADAPTER = 'http_adapter'; |
|
41 |
|
42 /** |
|
43 * Create collection. |
|
44 * |
|
45 * @param string $name |
|
46 * @param array $options |
|
47 * @return array |
|
48 */ |
|
49 public function createCollection($name, $options = null); |
|
50 |
|
51 /** |
|
52 * Delete collection. |
|
53 * |
|
54 * @param string $name |
|
55 * @param array $options |
|
56 * @return void |
|
57 */ |
|
58 public function deleteCollection($name, $options = null); |
|
59 |
|
60 /** |
|
61 * List collections. |
|
62 * |
|
63 * @param array $options |
|
64 * @return array List of collection names |
|
65 */ |
|
66 public function listCollections($options = null); |
|
67 |
|
68 /** |
|
69 * List all documents in a collection |
|
70 * |
|
71 * @param string $collectionName |
|
72 * @param null|array $options |
|
73 * @return Zend_Cloud_DocumentService_DocumentSet |
|
74 */ |
|
75 public function listDocuments($collectionName, array $options = null); |
|
76 |
|
77 /** |
|
78 * Insert document |
|
79 * |
|
80 * @param string $collectionName Collection name |
|
81 * @param Zend_Cloud_DocumentService_Document $document Document to insert |
|
82 * @param array $options |
|
83 * @return boolean |
|
84 */ |
|
85 public function insertDocument($collectionName, $document, $options = null); |
|
86 |
|
87 /** |
|
88 * Replace document |
|
89 * The new document replaces the existing document with the same ID. |
|
90 * |
|
91 * @param string $collectionName Collection name |
|
92 * @param Zend_Cloud_DocumentService_Document $document |
|
93 * @param array $options |
|
94 */ |
|
95 public function replaceDocument($collectionName, $document, $options = null); |
|
96 |
|
97 /** |
|
98 * Update document |
|
99 * The fields of the existing documents will be updated. |
|
100 * Fields not specified in the set will be left as-is. |
|
101 * |
|
102 * @param string $collectionName |
|
103 * @param mixed|Zend_Cloud_DocumentService_Document $documentID Document ID, adapter-dependent, or document containing updates |
|
104 * @param array|Zend_Cloud_DocumentService_Document $fieldset Set of fields to update |
|
105 * @param array $options |
|
106 * @return boolean |
|
107 */ |
|
108 public function updateDocument($collectionName, $documentID, $fieldset = null, $options = null); |
|
109 |
|
110 /** |
|
111 * Delete document |
|
112 * |
|
113 * @param string $collectionName Collection name |
|
114 * @param mixed $documentID Document ID, adapter-dependent |
|
115 * @param array $options |
|
116 * @return void |
|
117 */ |
|
118 public function deleteDocument($collectionName, $documentID, $options = null); |
|
119 |
|
120 /** |
|
121 * Fetch single document by ID |
|
122 * |
|
123 * Will return false if the document does not exist |
|
124 * |
|
125 * @param string $collectionName Collection name |
|
126 * @param mixed $documentID Document ID, adapter-dependent |
|
127 * @param array $options |
|
128 * @return Zend_Cloud_DocumentService_Document |
|
129 */ |
|
130 public function fetchDocument($collectionName, $documentID, $options = null); |
|
131 |
|
132 /** |
|
133 * Query for documents stored in the document service. If a string is passed in |
|
134 * $query, the query string will be passed directly to the service. |
|
135 * |
|
136 * @param string $collectionName Collection name |
|
137 * @param string $query |
|
138 * @param array $options |
|
139 * @return array Array of field sets |
|
140 */ |
|
141 public function query($collectionName, $query, $options = null); |
|
142 |
|
143 /** |
|
144 * Create query statement |
|
145 * |
|
146 * @param string $fields |
|
147 * @return Zend_Cloud_DocumentService_Query |
|
148 */ |
|
149 public function select($fields = null); |
|
150 |
|
151 /** |
|
152 * Get the concrete service client |
|
153 */ |
|
154 public function getClient(); |
|
155 } |