Statistics
| Branch: | Tag: | Revision:

root / pithos / backends / base.py @ b230052d

History | View | Annotate | Download (15.4 kB)

1 5635f9ef Antony Chazapis
# Copyright 2011 GRNET S.A. All rights reserved.
2 5635f9ef Antony Chazapis
# 
3 5635f9ef Antony Chazapis
# Redistribution and use in source and binary forms, with or
4 5635f9ef Antony Chazapis
# without modification, are permitted provided that the following
5 5635f9ef Antony Chazapis
# conditions are met:
6 5635f9ef Antony Chazapis
# 
7 5635f9ef Antony Chazapis
#   1. Redistributions of source code must retain the above
8 5635f9ef Antony Chazapis
#      copyright notice, this list of conditions and the following
9 5635f9ef Antony Chazapis
#      disclaimer.
10 5635f9ef Antony Chazapis
# 
11 5635f9ef Antony Chazapis
#   2. Redistributions in binary form must reproduce the above
12 5635f9ef Antony Chazapis
#      copyright notice, this list of conditions and the following
13 5635f9ef Antony Chazapis
#      disclaimer in the documentation and/or other materials
14 5635f9ef Antony Chazapis
#      provided with the distribution.
15 5635f9ef Antony Chazapis
# 
16 5635f9ef Antony Chazapis
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17 5635f9ef Antony Chazapis
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 5635f9ef Antony Chazapis
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 5635f9ef Antony Chazapis
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20 5635f9ef Antony Chazapis
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 5635f9ef Antony Chazapis
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 5635f9ef Antony Chazapis
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 5635f9ef Antony Chazapis
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 5635f9ef Antony Chazapis
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 5635f9ef Antony Chazapis
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 5635f9ef Antony Chazapis
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 5635f9ef Antony Chazapis
# POSSIBILITY OF SUCH DAMAGE.
28 5635f9ef Antony Chazapis
# 
29 5635f9ef Antony Chazapis
# The views and conclusions contained in the software and
30 5635f9ef Antony Chazapis
# documentation are those of the authors and should not be
31 5635f9ef Antony Chazapis
# interpreted as representing official policies, either expressed
32 5635f9ef Antony Chazapis
# or implied, of GRNET S.A.
33 5635f9ef Antony Chazapis
34 cca6c617 Antony Chazapis
class NotAllowedError(Exception):
35 cca6c617 Antony Chazapis
    pass
36 cca6c617 Antony Chazapis
37 b956618e Antony Chazapis
class BaseBackend(object):
38 22dab079 Antony Chazapis
    """Abstract backend class that serves as a reference for actual implementations.
39 b956618e Antony Chazapis
    
40 b956618e Antony Chazapis
    The purpose of the backend is to provide the necessary functions for handling data
41 b956618e Antony Chazapis
    and metadata. It is responsible for the actual storage and retrieval of information.
42 b956618e Antony Chazapis
    
43 b956618e Antony Chazapis
    Note that the account level is always valid as it is checked from another subsystem.
44 22dab079 Antony Chazapis
    
45 02c0c3fa Antony Chazapis
    When not replacing metadata/groups/policy, keys with empty values should be deleted.
46 a6eb13e9 Antony Chazapis
    
47 22dab079 Antony Chazapis
    The following variables should be available:
48 22dab079 Antony Chazapis
        'hash_algorithm': Suggested is 'sha256'
49 22dab079 Antony Chazapis
        'block_size': Suggested is 4MB
50 b956618e Antony Chazapis
    """
51 b956618e Antony Chazapis
    
52 f6c97079 Antony Chazapis
    def list_accounts(self, user, marker=None, limit=10000):
53 f6c97079 Antony Chazapis
        """Return a list of accounts the user can access.
54 f6c97079 Antony Chazapis
        
55 f6c97079 Antony Chazapis
        Parameters:
56 f6c97079 Antony Chazapis
            'marker': Start list from the next item after 'marker'
57 f6c97079 Antony Chazapis
            'limit': Number of containers to return
58 f6c97079 Antony Chazapis
        """
59 f6c97079 Antony Chazapis
        return []
60 f6c97079 Antony Chazapis
    
61 83dd59c5 Antony Chazapis
    def get_account_meta(self, user, account, until=None):
62 22dab079 Antony Chazapis
        """Return a dictionary with the account metadata.
63 b956618e Antony Chazapis
        
64 b956618e Antony Chazapis
        The keys returned are all user-defined, except:
65 b956618e Antony Chazapis
            'name': The account name
66 b956618e Antony Chazapis
            'count': The number of containers (or 0)
67 b956618e Antony Chazapis
            'bytes': The total data size (or 0)
68 58a6c894 Antony Chazapis
            'modified': Last modification timestamp (overall)
69 58a6c894 Antony Chazapis
            'until_timestamp': Last modification until the timestamp provided
70 cca6c617 Antony Chazapis
        
71 cca6c617 Antony Chazapis
        Raises:
72 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
73 b956618e Antony Chazapis
        """
74 b956618e Antony Chazapis
        return {}
75 b956618e Antony Chazapis
    
76 83dd59c5 Antony Chazapis
    def update_account_meta(self, user, account, meta, replace=False):
77 22dab079 Antony Chazapis
        """Update the metadata associated with the account.
78 b956618e Antony Chazapis
        
79 b956618e Antony Chazapis
        Parameters:
80 b956618e Antony Chazapis
            'meta': Dictionary with metadata to update
81 22dab079 Antony Chazapis
            'replace': Replace instead of update
82 cca6c617 Antony Chazapis
        
83 cca6c617 Antony Chazapis
        Raises:
84 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
85 b956618e Antony Chazapis
        """
86 b956618e Antony Chazapis
        return
87 b956618e Antony Chazapis
    
88 02c0c3fa Antony Chazapis
    def get_account_groups(self, user, account):
89 02c0c3fa Antony Chazapis
        """Return a dictionary with the user groups defined for this account.
90 cca6c617 Antony Chazapis
        
91 cca6c617 Antony Chazapis
        Raises:
92 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
93 58a6c894 Antony Chazapis
        """
94 02c0c3fa Antony Chazapis
        return {}
95 58a6c894 Antony Chazapis
    
96 02c0c3fa Antony Chazapis
    def update_account_groups(self, user, account, groups, replace=False):
97 02c0c3fa Antony Chazapis
        """Update the groups associated with the account.
98 83dd59c5 Antony Chazapis
        
99 b956618e Antony Chazapis
        Raises:
100 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
101 02c0c3fa Antony Chazapis
            ValueError: Invalid data in groups
102 b956618e Antony Chazapis
        """
103 b956618e Antony Chazapis
        return
104 b956618e Antony Chazapis
    
105 a9b3f29d Antony Chazapis
    def put_account(self, user, account):
106 a9b3f29d Antony Chazapis
        """Create a new account with the given name.
107 a9b3f29d Antony Chazapis
        
108 a9b3f29d Antony Chazapis
        Raises:
109 a9b3f29d Antony Chazapis
            NotAllowedError: Operation not permitted
110 a9b3f29d Antony Chazapis
        """
111 a9b3f29d Antony Chazapis
        return
112 a9b3f29d Antony Chazapis
    
113 02c0c3fa Antony Chazapis
    def delete_account(self, user, account):
114 02c0c3fa Antony Chazapis
        """Delete the account with the given name.
115 83dd59c5 Antony Chazapis
        
116 b956618e Antony Chazapis
        Raises:
117 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
118 02c0c3fa Antony Chazapis
            IndexError: Account is not empty
119 b956618e Antony Chazapis
        """
120 b956618e Antony Chazapis
        return
121 b956618e Antony Chazapis
    
122 b18ef3ad Antony Chazapis
    def list_containers(self, user, account, marker=None, limit=10000, shared=False, until=None):
123 f6c97079 Antony Chazapis
        """Return a list of container names existing under an account.
124 02c0c3fa Antony Chazapis
        
125 02c0c3fa Antony Chazapis
        Parameters:
126 02c0c3fa Antony Chazapis
            'marker': Start list from the next item after 'marker'
127 02c0c3fa Antony Chazapis
            'limit': Number of containers to return
128 b18ef3ad Antony Chazapis
            'shared': Only list containers with permissions set
129 02c0c3fa Antony Chazapis
        
130 02c0c3fa Antony Chazapis
        Raises:
131 02c0c3fa Antony Chazapis
            NotAllowedError: Operation not permitted
132 02c0c3fa Antony Chazapis
        """
133 02c0c3fa Antony Chazapis
        return []
134 02c0c3fa Antony Chazapis
    
135 83dd59c5 Antony Chazapis
    def get_container_meta(self, user, account, container, until=None):
136 22dab079 Antony Chazapis
        """Return a dictionary with the container metadata.
137 83dd59c5 Antony Chazapis
        
138 b956618e Antony Chazapis
        The keys returned are all user-defined, except:
139 b956618e Antony Chazapis
            'name': The container name
140 b956618e Antony Chazapis
            'count': The number of objects
141 b956618e Antony Chazapis
            'bytes': The total data size
142 58a6c894 Antony Chazapis
            'modified': Last modification timestamp (overall)
143 58a6c894 Antony Chazapis
            'until_timestamp': Last modification until the timestamp provided
144 b956618e Antony Chazapis
        
145 b956618e Antony Chazapis
        Raises:
146 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
147 b956618e Antony Chazapis
            NameError: Container does not exist
148 b956618e Antony Chazapis
        """
149 b956618e Antony Chazapis
        return {}
150 b956618e Antony Chazapis
    
151 83dd59c5 Antony Chazapis
    def update_container_meta(self, user, account, container, meta, replace=False):
152 22dab079 Antony Chazapis
        """Update the metadata associated with the container.
153 b956618e Antony Chazapis
        
154 b956618e Antony Chazapis
        Parameters:
155 b956618e Antony Chazapis
            'meta': Dictionary with metadata to update
156 22dab079 Antony Chazapis
            'replace': Replace instead of update
157 b956618e Antony Chazapis
        
158 b956618e Antony Chazapis
        Raises:
159 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
160 b956618e Antony Chazapis
            NameError: Container does not exist
161 b956618e Antony Chazapis
        """
162 b956618e Antony Chazapis
        return
163 b956618e Antony Chazapis
    
164 02c0c3fa Antony Chazapis
    def get_container_policy(self, user, account, container):
165 02c0c3fa Antony Chazapis
        """Return a dictionary with the container policy.
166 02c0c3fa Antony Chazapis
        
167 02c0c3fa Antony Chazapis
        The keys returned are:
168 02c0c3fa Antony Chazapis
            'quota': The maximum bytes allowed (default is 0 - unlimited)
169 02c0c3fa Antony Chazapis
            'versioning': Can be 'auto', 'manual' or 'none' (default is 'manual')
170 02c0c3fa Antony Chazapis
        
171 02c0c3fa Antony Chazapis
        Raises:
172 02c0c3fa Antony Chazapis
            NotAllowedError: Operation not permitted
173 02c0c3fa Antony Chazapis
            NameError: Container does not exist
174 02c0c3fa Antony Chazapis
        """
175 02c0c3fa Antony Chazapis
        return {}
176 02c0c3fa Antony Chazapis
    
177 02c0c3fa Antony Chazapis
    def update_container_policy(self, user, account, container, policy, replace=False):
178 02c0c3fa Antony Chazapis
        """Update the policy associated with the account.
179 02c0c3fa Antony Chazapis
        
180 02c0c3fa Antony Chazapis
        Raises:
181 02c0c3fa Antony Chazapis
            NotAllowedError: Operation not permitted
182 02c0c3fa Antony Chazapis
            NameError: Container does not exist
183 02c0c3fa Antony Chazapis
            ValueError: Invalid policy defined
184 02c0c3fa Antony Chazapis
        """
185 02c0c3fa Antony Chazapis
        return
186 02c0c3fa Antony Chazapis
    
187 02c0c3fa Antony Chazapis
    def put_container(self, user, account, container, policy=None):
188 02c0c3fa Antony Chazapis
        """Create a new container with the given name.
189 02c0c3fa Antony Chazapis
        
190 02c0c3fa Antony Chazapis
        Raises:
191 02c0c3fa Antony Chazapis
            NotAllowedError: Operation not permitted
192 02c0c3fa Antony Chazapis
            NameError: Container already exists
193 02c0c3fa Antony Chazapis
            ValueError: Invalid policy defined
194 02c0c3fa Antony Chazapis
        """
195 02c0c3fa Antony Chazapis
        return
196 02c0c3fa Antony Chazapis
    
197 84846143 Antony Chazapis
    def delete_container(self, user, account, container, until=None):
198 84846143 Antony Chazapis
        """Delete/purge the container with the given name.
199 02c0c3fa Antony Chazapis
        
200 02c0c3fa Antony Chazapis
        Raises:
201 02c0c3fa Antony Chazapis
            NotAllowedError: Operation not permitted
202 02c0c3fa Antony Chazapis
            NameError: Container does not exist
203 02c0c3fa Antony Chazapis
            IndexError: Container is not empty
204 02c0c3fa Antony Chazapis
        """
205 02c0c3fa Antony Chazapis
        return
206 02c0c3fa Antony Chazapis
    
207 b18ef3ad Antony Chazapis
    def list_objects(self, user, account, container, prefix='', delimiter=None, marker=None, limit=10000, virtual=True, keys=[], shared=False, until=None):
208 58a6c894 Antony Chazapis
        """Return a list of object (name, version_id) tuples existing under a container.
209 b956618e Antony Chazapis
        
210 b956618e Antony Chazapis
        Parameters:
211 b956618e Antony Chazapis
            'prefix': List objects starting with 'prefix'
212 b956618e Antony Chazapis
            'delimiter': Return unique names before 'delimiter' and after 'prefix'
213 b956618e Antony Chazapis
            'marker': Start list from the next item after 'marker'
214 b956618e Antony Chazapis
            'limit': Number of objects to return
215 3f839f59 Antony Chazapis
            'virtual': If not set, the result will only include names starting\
216 3f839f59 Antony Chazapis
                       with 'prefix' and ending without a 'delimiter' or with\
217 3f839f59 Antony Chazapis
                       the first occurance of the 'delimiter' after 'prefix'.\
218 3f839f59 Antony Chazapis
                       If set, the result will include all names after 'prefix',\
219 3f839f59 Antony Chazapis
                       up to and including the 'delimiter' if it is found
220 22dab079 Antony Chazapis
            'keys': Include objects that have meta with the keys in the list
221 b18ef3ad Antony Chazapis
            'shared': Only list objects with permissions set
222 22dab079 Antony Chazapis
        
223 22dab079 Antony Chazapis
        Raises:
224 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
225 22dab079 Antony Chazapis
            NameError: Container does not exist
226 22dab079 Antony Chazapis
        """
227 22dab079 Antony Chazapis
        return []
228 22dab079 Antony Chazapis
    
229 83dd59c5 Antony Chazapis
    def list_object_meta(self, user, account, container, until=None):
230 22dab079 Antony Chazapis
        """Return a list with all the container's object meta keys.
231 b956618e Antony Chazapis
        
232 b956618e Antony Chazapis
        Raises:
233 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
234 b956618e Antony Chazapis
            NameError: Container does not exist
235 b956618e Antony Chazapis
        """
236 b956618e Antony Chazapis
        return []
237 b956618e Antony Chazapis
    
238 83dd59c5 Antony Chazapis
    def get_object_meta(self, user, account, container, name, version=None):
239 22dab079 Antony Chazapis
        """Return a dictionary with the object metadata.
240 b956618e Antony Chazapis
        
241 b956618e Antony Chazapis
        The keys returned are all user-defined, except:
242 58a6c894 Antony Chazapis
            'name': The object name
243 b956618e Antony Chazapis
            'bytes': The total data size
244 58a6c894 Antony Chazapis
            'modified': Last modification timestamp (overall)
245 104626e3 Antony Chazapis
            'modified_by': The user that committed the object (version requested)
246 58a6c894 Antony Chazapis
            'version': The version identifier
247 58a6c894 Antony Chazapis
            'version_timestamp': The version's modification timestamp
248 b956618e Antony Chazapis
        
249 b956618e Antony Chazapis
        Raises:
250 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
251 b956618e Antony Chazapis
            NameError: Container/object does not exist
252 58a6c894 Antony Chazapis
            IndexError: Version does not exist
253 b956618e Antony Chazapis
        """
254 b956618e Antony Chazapis
        return {}
255 b956618e Antony Chazapis
    
256 83dd59c5 Antony Chazapis
    def update_object_meta(self, user, account, container, name, meta, replace=False):
257 22dab079 Antony Chazapis
        """Update the metadata associated with the object.
258 b956618e Antony Chazapis
        
259 b956618e Antony Chazapis
        Parameters:
260 a6eb13e9 Antony Chazapis
            'meta': Dictionary with metadata to update
261 22dab079 Antony Chazapis
            'replace': Replace instead of update
262 b956618e Antony Chazapis
        
263 b956618e Antony Chazapis
        Raises:
264 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
265 b956618e Antony Chazapis
            NameError: Container/object does not exist
266 b956618e Antony Chazapis
        """
267 b956618e Antony Chazapis
        return
268 b956618e Antony Chazapis
    
269 3436eeb0 Antony Chazapis
    def get_object_permissions(self, user, account, container, name):
270 cca6c617 Antony Chazapis
        """Return the path from which this object gets its permissions from,\
271 cca6c617 Antony Chazapis
        along with a dictionary containing the permissions.
272 3436eeb0 Antony Chazapis
        
273 3436eeb0 Antony Chazapis
        The keys are:
274 3436eeb0 Antony Chazapis
            'read': The object is readable by the users/groups in the list
275 3436eeb0 Antony Chazapis
            'write': The object is writable by the users/groups in the list
276 3436eeb0 Antony Chazapis
        
277 3436eeb0 Antony Chazapis
        Raises:
278 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
279 3436eeb0 Antony Chazapis
            NameError: Container/object does not exist
280 3436eeb0 Antony Chazapis
        """
281 3436eeb0 Antony Chazapis
        return {}
282 3436eeb0 Antony Chazapis
    
283 3436eeb0 Antony Chazapis
    def update_object_permissions(self, user, account, container, name, permissions):
284 3436eeb0 Antony Chazapis
        """Update the permissions associated with the object.
285 3436eeb0 Antony Chazapis
        
286 3436eeb0 Antony Chazapis
        Parameters:
287 3436eeb0 Antony Chazapis
            'permissions': Dictionary with permissions to update
288 3436eeb0 Antony Chazapis
        
289 3436eeb0 Antony Chazapis
        Raises:
290 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
291 3436eeb0 Antony Chazapis
            NameError: Container/object does not exist
292 3436eeb0 Antony Chazapis
            ValueError: Invalid users/groups in permissions
293 3436eeb0 Antony Chazapis
            AttributeError: Can not set permissions, as this object\
294 3436eeb0 Antony Chazapis
                is already shared/private by another object higher\
295 3436eeb0 Antony Chazapis
                in the hierarchy, or setting permissions here will\
296 3436eeb0 Antony Chazapis
                invalidate other permissions deeper in the hierarchy
297 3436eeb0 Antony Chazapis
        """
298 3436eeb0 Antony Chazapis
        return
299 3436eeb0 Antony Chazapis
    
300 02c0c3fa Antony Chazapis
    def get_object_public(self, user, account, container, name):
301 02c0c3fa Antony Chazapis
        """Return the public URL of the object if applicable.
302 02c0c3fa Antony Chazapis
        
303 02c0c3fa Antony Chazapis
        Raises:
304 02c0c3fa Antony Chazapis
            NotAllowedError: Operation not permitted
305 02c0c3fa Antony Chazapis
            NameError: Container/object does not exist
306 02c0c3fa Antony Chazapis
        """
307 02c0c3fa Antony Chazapis
        return None
308 02c0c3fa Antony Chazapis
    
309 02c0c3fa Antony Chazapis
    def update_object_public(self, user, account, container, name, public):
310 02c0c3fa Antony Chazapis
        """Update the public status of the object.
311 02c0c3fa Antony Chazapis
        
312 02c0c3fa Antony Chazapis
        Parameters:
313 02c0c3fa Antony Chazapis
            'public': Boolean value
314 02c0c3fa Antony Chazapis
        
315 02c0c3fa Antony Chazapis
        Raises:
316 02c0c3fa Antony Chazapis
            NotAllowedError: Operation not permitted
317 02c0c3fa Antony Chazapis
            NameError: Container/object does not exist
318 02c0c3fa Antony Chazapis
        """
319 02c0c3fa Antony Chazapis
        return
320 02c0c3fa Antony Chazapis
    
321 83dd59c5 Antony Chazapis
    def get_object_hashmap(self, user, account, container, name, version=None):
322 22dab079 Antony Chazapis
        """Return the object's size and a list with partial hashes.
323 b956618e Antony Chazapis
        
324 b956618e Antony Chazapis
        Raises:
325 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
326 b956618e Antony Chazapis
            NameError: Container/object does not exist
327 22dab079 Antony Chazapis
            IndexError: Version does not exist
328 b956618e Antony Chazapis
        """
329 22dab079 Antony Chazapis
        return 0, []
330 b956618e Antony Chazapis
    
331 cca6c617 Antony Chazapis
    def update_object_hashmap(self, user, account, container, name, size, hashmap, meta={}, replace_meta=False, permissions=None):
332 22dab079 Antony Chazapis
        """Create/update an object with the specified size and partial hashes.
333 b956618e Antony Chazapis
        
334 3436eeb0 Antony Chazapis
        Parameters:
335 3436eeb0 Antony Chazapis
            'dest_meta': Dictionary with metadata to change
336 3436eeb0 Antony Chazapis
            'replace_meta': Replace metadata instead of update
337 3436eeb0 Antony Chazapis
            'permissions': Updated object permissions
338 3436eeb0 Antony Chazapis
        
339 b956618e Antony Chazapis
        Raises:
340 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
341 58a6c894 Antony Chazapis
            NameError: Container does not exist
342 3436eeb0 Antony Chazapis
            ValueError: Invalid users/groups in permissions
343 3436eeb0 Antony Chazapis
            AttributeError: Can not set permissions
344 b956618e Antony Chazapis
        """
345 b956618e Antony Chazapis
        return
346 b956618e Antony Chazapis
    
347 cca6c617 Antony Chazapis
    def copy_object(self, user, account, src_container, src_name, dest_container, dest_name, dest_meta={}, replace_meta=False, permissions=None, src_version=None):
348 22dab079 Antony Chazapis
        """Copy an object's data and metadata.
349 b956618e Antony Chazapis
        
350 b956618e Antony Chazapis
        Parameters:
351 3436eeb0 Antony Chazapis
            'dest_meta': Dictionary with metadata to change from source to destination
352 22dab079 Antony Chazapis
            'replace_meta': Replace metadata instead of update
353 3436eeb0 Antony Chazapis
            'permissions': New object permissions
354 3436eeb0 Antony Chazapis
            'src_version': Copy from the version provided
355 b956618e Antony Chazapis
        
356 b956618e Antony Chazapis
        Raises:
357 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
358 b956618e Antony Chazapis
            NameError: Container/object does not exist
359 58a6c894 Antony Chazapis
            IndexError: Version does not exist
360 3436eeb0 Antony Chazapis
            ValueError: Invalid users/groups in permissions
361 3436eeb0 Antony Chazapis
            AttributeError: Can not set permissions
362 b956618e Antony Chazapis
        """
363 b956618e Antony Chazapis
        return
364 b956618e Antony Chazapis
    
365 cca6c617 Antony Chazapis
    def move_object(self, user, account, src_container, src_name, dest_container, dest_name, dest_meta={}, replace_meta=False, permissions=None):
366 22dab079 Antony Chazapis
        """Move an object's data and metadata.
367 b956618e Antony Chazapis
        
368 b956618e Antony Chazapis
        Parameters:
369 3436eeb0 Antony Chazapis
            'dest_meta': Dictionary with metadata to change from source to destination
370 22dab079 Antony Chazapis
            'replace_meta': Replace metadata instead of update
371 3436eeb0 Antony Chazapis
            'permissions': New object permissions
372 b956618e Antony Chazapis
        
373 b956618e Antony Chazapis
        Raises:
374 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
375 b956618e Antony Chazapis
            NameError: Container/object does not exist
376 3436eeb0 Antony Chazapis
            ValueError: Invalid users/groups in permissions
377 3436eeb0 Antony Chazapis
            AttributeError: Can not set permissions
378 b956618e Antony Chazapis
        """
379 b956618e Antony Chazapis
        return
380 b956618e Antony Chazapis
    
381 84846143 Antony Chazapis
    def delete_object(self, user, account, container, name, until=None):
382 84846143 Antony Chazapis
        """Delete/purge an object.
383 b956618e Antony Chazapis
        
384 b956618e Antony Chazapis
        Raises:
385 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
386 b956618e Antony Chazapis
            NameError: Container/object does not exist
387 b956618e Antony Chazapis
        """
388 b956618e Antony Chazapis
        return
389 22dab079 Antony Chazapis
    
390 83dd59c5 Antony Chazapis
    def list_versions(self, user, account, container, name):
391 cca6c617 Antony Chazapis
        """Return a list of all (version, version_timestamp) tuples for an object.
392 cca6c617 Antony Chazapis
        
393 cca6c617 Antony Chazapis
        Raises:
394 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
395 cca6c617 Antony Chazapis
        """
396 58a6c894 Antony Chazapis
        return []
397 58a6c894 Antony Chazapis
    
398 22dab079 Antony Chazapis
    def get_block(self, hash):
399 22dab079 Antony Chazapis
        """Return a block's data.
400 22dab079 Antony Chazapis
        
401 22dab079 Antony Chazapis
        Raises:
402 22dab079 Antony Chazapis
            NameError: Block does not exist
403 22dab079 Antony Chazapis
        """
404 22dab079 Antony Chazapis
        return ''
405 22dab079 Antony Chazapis
    
406 22dab079 Antony Chazapis
    def put_block(self, data):
407 22dab079 Antony Chazapis
        """Store a block and return the hash."""
408 22dab079 Antony Chazapis
        return 0
409 22dab079 Antony Chazapis
    
410 22dab079 Antony Chazapis
    def update_block(self, hash, data, offset=0):
411 22dab079 Antony Chazapis
        """Update a known block and return the hash.
412 22dab079 Antony Chazapis
        
413 22dab079 Antony Chazapis
        Raises:
414 22dab079 Antony Chazapis
            IndexError: Offset or data outside block limits
415 22dab079 Antony Chazapis
        """
416 22dab079 Antony Chazapis
        return 0