Statistics
| Branch: | Tag: | Revision:

root / snf-pithos-backend / pithos / backends / base.py @ e647d184

History | View | Annotate | Download (19.6 kB)

1 2e662088 Antony Chazapis
# Copyright 2011-2012 GRNET S.A. All rights reserved.
2 2715ade4 Sofia Papagiannaki
#
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 2715ade4 Sofia Papagiannaki
#
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 2715ade4 Sofia Papagiannaki
#
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 2715ade4 Sofia Papagiannaki
#
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 2715ade4 Sofia Papagiannaki
#
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 228de81b Antony Chazapis
# Default setting for new accounts.
35 2715ade4 Sofia Papagiannaki
DEFAULT_QUOTA = 0  # No quota.
36 228de81b Antony Chazapis
DEFAULT_VERSIONING = 'auto'
37 228de81b Antony Chazapis
38 228de81b Antony Chazapis
39 2715ade4 Sofia Papagiannaki
40 cca6c617 Antony Chazapis
class NotAllowedError(Exception):
41 cca6c617 Antony Chazapis
    pass
42 cca6c617 Antony Chazapis
43 2715ade4 Sofia Papagiannaki
44 5df6c6d1 Antony Chazapis
class QuotaError(Exception):
45 5df6c6d1 Antony Chazapis
    pass
46 5df6c6d1 Antony Chazapis
47 2715ade4 Sofia Papagiannaki
48 7efc9f86 Sofia Papagiannaki
class AccountExists(NameError):
49 7efc9f86 Sofia Papagiannaki
    pass
50 2715ade4 Sofia Papagiannaki
51 2715ade4 Sofia Papagiannaki
52 7efc9f86 Sofia Papagiannaki
class ContainerExists(NameError):
53 7efc9f86 Sofia Papagiannaki
    pass
54 7efc9f86 Sofia Papagiannaki
55 2715ade4 Sofia Papagiannaki
56 7efc9f86 Sofia Papagiannaki
class AccountNotEmpty(IndexError):
57 7efc9f86 Sofia Papagiannaki
    pass
58 7efc9f86 Sofia Papagiannaki
59 2715ade4 Sofia Papagiannaki
60 7efc9f86 Sofia Papagiannaki
class ContainerNotEmpty(IndexError):
61 7efc9f86 Sofia Papagiannaki
    pass
62 7efc9f86 Sofia Papagiannaki
63 2715ade4 Sofia Papagiannaki
64 7efc9f86 Sofia Papagiannaki
class ItemNotExists(NameError):
65 7efc9f86 Sofia Papagiannaki
    pass
66 7efc9f86 Sofia Papagiannaki
67 2715ade4 Sofia Papagiannaki
68 7efc9f86 Sofia Papagiannaki
class VersionNotExists(IndexError):
69 7efc9f86 Sofia Papagiannaki
    pass
70 7efc9f86 Sofia Papagiannaki
71 2715ade4 Sofia Papagiannaki
class BaseBackend(object):
72 22dab079 Antony Chazapis
    """Abstract backend class that serves as a reference for actual implementations.
73 2715ade4 Sofia Papagiannaki

74 b956618e Antony Chazapis
    The purpose of the backend is to provide the necessary functions for handling data
75 b956618e Antony Chazapis
    and metadata. It is responsible for the actual storage and retrieval of information.
76 2715ade4 Sofia Papagiannaki

77 b956618e Antony Chazapis
    Note that the account level is always valid as it is checked from another subsystem.
78 2715ade4 Sofia Papagiannaki

79 02c0c3fa Antony Chazapis
    When not replacing metadata/groups/policy, keys with empty values should be deleted.
80 2715ade4 Sofia Papagiannaki

81 22dab079 Antony Chazapis
    The following variables should be available:
82 22dab079 Antony Chazapis
        'hash_algorithm': Suggested is 'sha256'
83 2715ade4 Sofia Papagiannaki

84 22dab079 Antony Chazapis
        'block_size': Suggested is 4MB
85 2715ade4 Sofia Papagiannaki

86 b2832c6a Antony Chazapis
        'default_policy': A dictionary with default policy settings
87 b956618e Antony Chazapis
    """
88 2715ade4 Sofia Papagiannaki
89 d14fe290 Antony Chazapis
    def close(self):
90 d14fe290 Antony Chazapis
        """Close the backend connection."""
91 d14fe290 Antony Chazapis
        pass
92 2715ade4 Sofia Papagiannaki
93 f6c97079 Antony Chazapis
    def list_accounts(self, user, marker=None, limit=10000):
94 f6c97079 Antony Chazapis
        """Return a list of accounts the user can access.
95 2715ade4 Sofia Papagiannaki

96 f6c97079 Antony Chazapis
        Parameters:
97 f6c97079 Antony Chazapis
            'marker': Start list from the next item after 'marker'
98 2715ade4 Sofia Papagiannaki

99 f6c97079 Antony Chazapis
            'limit': Number of containers to return
100 f6c97079 Antony Chazapis
        """
101 f6c97079 Antony Chazapis
        return []
102 2715ade4 Sofia Papagiannaki
103 82482e2c Antony Chazapis
    def get_account_meta(self, user, account, domain, until=None, include_user_defined=True):
104 cb69c154 Antony Chazapis
        """Return a dictionary with the account metadata for the domain.
105 2715ade4 Sofia Papagiannaki

106 b956618e Antony Chazapis
        The keys returned are all user-defined, except:
107 b956618e Antony Chazapis
            'name': The account name
108 2715ade4 Sofia Papagiannaki

109 b956618e Antony Chazapis
            'count': The number of containers (or 0)
110 2715ade4 Sofia Papagiannaki

111 b956618e Antony Chazapis
            'bytes': The total data size (or 0)
112 2715ade4 Sofia Papagiannaki

113 58a6c894 Antony Chazapis
            'modified': Last modification timestamp (overall)
114 2715ade4 Sofia Papagiannaki

115 58a6c894 Antony Chazapis
            'until_timestamp': Last modification until the timestamp provided
116 2715ade4 Sofia Papagiannaki

117 cca6c617 Antony Chazapis
        Raises:
118 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
119 b956618e Antony Chazapis
        """
120 b956618e Antony Chazapis
        return {}
121 2715ade4 Sofia Papagiannaki
122 cb69c154 Antony Chazapis
    def update_account_meta(self, user, account, domain, meta, replace=False):
123 cb69c154 Antony Chazapis
        """Update the metadata associated with the account for the domain.
124 2715ade4 Sofia Papagiannaki

125 b956618e Antony Chazapis
        Parameters:
126 cb69c154 Antony Chazapis
            'domain': Metadata domain
127 2715ade4 Sofia Papagiannaki

128 b956618e Antony Chazapis
            'meta': Dictionary with metadata to update
129 2715ade4 Sofia Papagiannaki

130 22dab079 Antony Chazapis
            'replace': Replace instead of update
131 2715ade4 Sofia Papagiannaki

132 cca6c617 Antony Chazapis
        Raises:
133 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
134 b956618e Antony Chazapis
        """
135 b956618e Antony Chazapis
        return
136 2715ade4 Sofia Papagiannaki
137 02c0c3fa Antony Chazapis
    def get_account_groups(self, user, account):
138 02c0c3fa Antony Chazapis
        """Return a dictionary with the user groups defined for this account.
139 2715ade4 Sofia Papagiannaki

140 cca6c617 Antony Chazapis
        Raises:
141 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
142 58a6c894 Antony Chazapis
        """
143 02c0c3fa Antony Chazapis
        return {}
144 2715ade4 Sofia Papagiannaki
145 02c0c3fa Antony Chazapis
    def update_account_groups(self, user, account, groups, replace=False):
146 02c0c3fa Antony Chazapis
        """Update the groups associated with the account.
147 2715ade4 Sofia Papagiannaki

148 b956618e Antony Chazapis
        Raises:
149 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
150 2715ade4 Sofia Papagiannaki

151 02c0c3fa Antony Chazapis
            ValueError: Invalid data in groups
152 b956618e Antony Chazapis
        """
153 b956618e Antony Chazapis
        return
154 2715ade4 Sofia Papagiannaki
155 b2832c6a Antony Chazapis
    def get_account_policy(self, user, account):
156 b2832c6a Antony Chazapis
        """Return a dictionary with the account policy.
157 2715ade4 Sofia Papagiannaki

158 b2832c6a Antony Chazapis
        The keys returned are:
159 b2832c6a Antony Chazapis
            'quota': The maximum bytes allowed (default is 0 - unlimited)
160 2715ade4 Sofia Papagiannaki

161 b2832c6a Antony Chazapis
            'versioning': Can be 'auto', 'manual' or 'none' (default is 'manual')
162 2715ade4 Sofia Papagiannaki

163 b2832c6a Antony Chazapis
        Raises:
164 b2832c6a Antony Chazapis
            NotAllowedError: Operation not permitted
165 b2832c6a Antony Chazapis
        """
166 b2832c6a Antony Chazapis
        return {}
167 2715ade4 Sofia Papagiannaki
168 b2832c6a Antony Chazapis
    def update_account_policy(self, user, account, policy, replace=False):
169 b2832c6a Antony Chazapis
        """Update the policy associated with the account.
170 2715ade4 Sofia Papagiannaki

171 b2832c6a Antony Chazapis
        Raises:
172 b2832c6a Antony Chazapis
            NotAllowedError: Operation not permitted
173 2715ade4 Sofia Papagiannaki

174 b2832c6a Antony Chazapis
            ValueError: Invalid policy defined
175 b2832c6a Antony Chazapis
        """
176 b2832c6a Antony Chazapis
        return
177 2715ade4 Sofia Papagiannaki
178 1c50a9e5 Sofia Papagiannaki
    def put_account(self, user, account, policy={}):
179 a9b3f29d Antony Chazapis
        """Create a new account with the given name.
180 2715ade4 Sofia Papagiannaki

181 a9b3f29d Antony Chazapis
        Raises:
182 a9b3f29d Antony Chazapis
            NotAllowedError: Operation not permitted
183 2715ade4 Sofia Papagiannaki

184 b2832c6a Antony Chazapis
            ValueError: Invalid policy defined
185 a9b3f29d Antony Chazapis
        """
186 a9b3f29d Antony Chazapis
        return
187 2715ade4 Sofia Papagiannaki
188 02c0c3fa Antony Chazapis
    def delete_account(self, user, account):
189 02c0c3fa Antony Chazapis
        """Delete the account with the given name.
190 2715ade4 Sofia Papagiannaki

191 b956618e Antony Chazapis
        Raises:
192 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
193 2715ade4 Sofia Papagiannaki

194 7efc9f86 Sofia Papagiannaki
            AccountNotEmpty: Account is not empty
195 b956618e Antony Chazapis
        """
196 b956618e Antony Chazapis
        return
197 2715ade4 Sofia Papagiannaki
198 4d15c94e Sofia Papagiannaki
    def list_containers(self, user, account, marker=None, limit=10000, shared=False, until=None, public=False):
199 f6c97079 Antony Chazapis
        """Return a list of container names existing under an account.
200 2715ade4 Sofia Papagiannaki

201 02c0c3fa Antony Chazapis
        Parameters:
202 02c0c3fa Antony Chazapis
            'marker': Start list from the next item after 'marker'
203 2715ade4 Sofia Papagiannaki

204 02c0c3fa Antony Chazapis
            'limit': Number of containers to return
205 2715ade4 Sofia Papagiannaki

206 b18ef3ad Antony Chazapis
            'shared': Only list containers with permissions set
207 2715ade4 Sofia Papagiannaki

208 4d15c94e Sofia Papagiannaki
            'public': Only list containers containing public objects
209 2715ade4 Sofia Papagiannaki

210 2715ade4 Sofia Papagiannaki

211 02c0c3fa Antony Chazapis
        Raises:
212 02c0c3fa Antony Chazapis
            NotAllowedError: Operation not permitted
213 02c0c3fa Antony Chazapis
        """
214 02c0c3fa Antony Chazapis
        return []
215 2715ade4 Sofia Papagiannaki
216 371d907a Antony Chazapis
    def list_container_meta(self, user, account, container, domain, until=None):
217 371d907a Antony Chazapis
        """Return a list with all the container's object meta keys for the domain.
218 2715ade4 Sofia Papagiannaki

219 371d907a Antony Chazapis
        Raises:
220 371d907a Antony Chazapis
            NotAllowedError: Operation not permitted
221 2715ade4 Sofia Papagiannaki

222 7efc9f86 Sofia Papagiannaki
            ItemNotExists: Container does not exist
223 371d907a Antony Chazapis
        """
224 371d907a Antony Chazapis
        return []
225 2715ade4 Sofia Papagiannaki
226 82482e2c Antony Chazapis
    def get_container_meta(self, user, account, container, domain, until=None, include_user_defined=True):
227 cb69c154 Antony Chazapis
        """Return a dictionary with the container metadata for the domain.
228 2715ade4 Sofia Papagiannaki

229 b956618e Antony Chazapis
        The keys returned are all user-defined, except:
230 b956618e Antony Chazapis
            'name': The container name
231 2715ade4 Sofia Papagiannaki

232 b956618e Antony Chazapis
            'count': The number of objects
233 2715ade4 Sofia Papagiannaki

234 b956618e Antony Chazapis
            'bytes': The total data size
235 2715ade4 Sofia Papagiannaki

236 58a6c894 Antony Chazapis
            'modified': Last modification timestamp (overall)
237 2715ade4 Sofia Papagiannaki

238 58a6c894 Antony Chazapis
            'until_timestamp': Last modification until the timestamp provided
239 2715ade4 Sofia Papagiannaki

240 b956618e Antony Chazapis
        Raises:
241 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
242 2715ade4 Sofia Papagiannaki

243 7efc9f86 Sofia Papagiannaki
            ItemNotExists: Container does not exist
244 b956618e Antony Chazapis
        """
245 b956618e Antony Chazapis
        return {}
246 2715ade4 Sofia Papagiannaki
247 cb69c154 Antony Chazapis
    def update_container_meta(self, user, account, container, domain, meta, replace=False):
248 cb69c154 Antony Chazapis
        """Update the metadata associated with the container for the domain.
249 2715ade4 Sofia Papagiannaki

250 b956618e Antony Chazapis
        Parameters:
251 cb69c154 Antony Chazapis
            'domain': Metadata domain
252 2715ade4 Sofia Papagiannaki

253 b956618e Antony Chazapis
            'meta': Dictionary with metadata to update
254 2715ade4 Sofia Papagiannaki

255 22dab079 Antony Chazapis
            'replace': Replace instead of update
256 2715ade4 Sofia Papagiannaki

257 b956618e Antony Chazapis
        Raises:
258 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
259 2715ade4 Sofia Papagiannaki

260 7efc9f86 Sofia Papagiannaki
            ItemNotExists: Container does not exist
261 b956618e Antony Chazapis
        """
262 b956618e Antony Chazapis
        return
263 2715ade4 Sofia Papagiannaki
264 02c0c3fa Antony Chazapis
    def get_container_policy(self, user, account, container):
265 02c0c3fa Antony Chazapis
        """Return a dictionary with the container policy.
266 2715ade4 Sofia Papagiannaki

267 02c0c3fa Antony Chazapis
        The keys returned are:
268 02c0c3fa Antony Chazapis
            'quota': The maximum bytes allowed (default is 0 - unlimited)
269 2715ade4 Sofia Papagiannaki

270 02c0c3fa Antony Chazapis
            'versioning': Can be 'auto', 'manual' or 'none' (default is 'manual')
271 2715ade4 Sofia Papagiannaki

272 02c0c3fa Antony Chazapis
        Raises:
273 02c0c3fa Antony Chazapis
            NotAllowedError: Operation not permitted
274 2715ade4 Sofia Papagiannaki

275 7efc9f86 Sofia Papagiannaki
            ItemNotExists: Container does not exist
276 02c0c3fa Antony Chazapis
        """
277 02c0c3fa Antony Chazapis
        return {}
278 2715ade4 Sofia Papagiannaki
279 02c0c3fa Antony Chazapis
    def update_container_policy(self, user, account, container, policy, replace=False):
280 b2832c6a Antony Chazapis
        """Update the policy associated with the container.
281 2715ade4 Sofia Papagiannaki

282 02c0c3fa Antony Chazapis
        Raises:
283 02c0c3fa Antony Chazapis
            NotAllowedError: Operation not permitted
284 2715ade4 Sofia Papagiannaki

285 7efc9f86 Sofia Papagiannaki
            ItemNotExists: Container does not exist
286 2715ade4 Sofia Papagiannaki

287 02c0c3fa Antony Chazapis
            ValueError: Invalid policy defined
288 02c0c3fa Antony Chazapis
        """
289 02c0c3fa Antony Chazapis
        return
290 2715ade4 Sofia Papagiannaki
291 e46b2bcf Sofia Papagiannaki
    def put_container(self, user, account, container, policy={}, delimiter=None):
292 02c0c3fa Antony Chazapis
        """Create a new container with the given name.
293 2715ade4 Sofia Papagiannaki

294 e46b2bcf Sofia Papagiannaki
        Parameters:
295 e46b2bcf Sofia Papagiannaki
            'delimiter': If present deletes container contents instead of the container
296 2715ade4 Sofia Papagiannaki

297 02c0c3fa Antony Chazapis
        Raises:
298 02c0c3fa Antony Chazapis
            NotAllowedError: Operation not permitted
299 2715ade4 Sofia Papagiannaki

300 7efc9f86 Sofia Papagiannaki
            ContainerExists: Container already exists
301 2715ade4 Sofia Papagiannaki

302 02c0c3fa Antony Chazapis
            ValueError: Invalid policy defined
303 02c0c3fa Antony Chazapis
        """
304 02c0c3fa Antony Chazapis
        return
305 2715ade4 Sofia Papagiannaki
306 84846143 Antony Chazapis
    def delete_container(self, user, account, container, until=None):
307 84846143 Antony Chazapis
        """Delete/purge the container with the given name.
308 2715ade4 Sofia Papagiannaki

309 02c0c3fa Antony Chazapis
        Raises:
310 02c0c3fa Antony Chazapis
            NotAllowedError: Operation not permitted
311 2715ade4 Sofia Papagiannaki

312 7efc9f86 Sofia Papagiannaki
            ItemNotExists: Container does not exist
313 2715ade4 Sofia Papagiannaki

314 7efc9f86 Sofia Papagiannaki
            ContainerNotEmpty: Container is not empty
315 02c0c3fa Antony Chazapis
        """
316 02c0c3fa Antony Chazapis
        return
317 2715ade4 Sofia Papagiannaki
318 4d15c94e Sofia Papagiannaki
    def list_objects(self, user, account, container, prefix='', delimiter=None, marker=None, limit=10000, virtual=True, domain=None, keys=[], shared=False, until=None, size_range=None, public=False):
319 58a6c894 Antony Chazapis
        """Return a list of object (name, version_id) tuples existing under a container.
320 2715ade4 Sofia Papagiannaki

321 b956618e Antony Chazapis
        Parameters:
322 b956618e Antony Chazapis
            'prefix': List objects starting with 'prefix'
323 2715ade4 Sofia Papagiannaki

324 b956618e Antony Chazapis
            'delimiter': Return unique names before 'delimiter' and after 'prefix'
325 2715ade4 Sofia Papagiannaki

326 b956618e Antony Chazapis
            'marker': Start list from the next item after 'marker'
327 2715ade4 Sofia Papagiannaki

328 b956618e Antony Chazapis
            'limit': Number of objects to return
329 2715ade4 Sofia Papagiannaki

330 f4b61e0c Antony Chazapis
            'virtual': If not set, the result will only include names starting
331 f4b61e0c Antony Chazapis
                       with 'prefix' and ending without a 'delimiter' or with
332 f4b61e0c Antony Chazapis
                       the first occurance of the 'delimiter' after 'prefix'.
333 f4b61e0c Antony Chazapis
                       If set, the result will include all names after 'prefix',
334 3f839f59 Antony Chazapis
                       up to and including the 'delimiter' if it is found
335 2715ade4 Sofia Papagiannaki

336 cb69c154 Antony Chazapis
            'domain': Metadata domain for keys
337 2715ade4 Sofia Papagiannaki

338 95d47e1a Antony Chazapis
            'keys': Include objects that satisfy the key queries in the list.
339 95d47e1a Antony Chazapis
                    Use 'key', '!key' for existence queries, 'key op value' for
340 4e5673a0 Antony Chazapis
                    value queries, where 'op' can be one of =, !=, <=, >=, <, >
341 2715ade4 Sofia Papagiannaki

342 b18ef3ad Antony Chazapis
            'shared': Only list objects with permissions set
343 2715ade4 Sofia Papagiannaki

344 7ff57991 Antony Chazapis
            'size_range': Include objects with byte size in (from, to).
345 7ff57991 Antony Chazapis
                          Use None to specify unlimited
346 2715ade4 Sofia Papagiannaki

347 4d15c94e Sofia Papagiannaki
            'public': Only list public objects
348 2715ade4 Sofia Papagiannaki

349 2715ade4 Sofia Papagiannaki

350 22dab079 Antony Chazapis
        Raises:
351 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
352 2715ade4 Sofia Papagiannaki

353 7efc9f86 Sofia Papagiannaki
            ItemNotExists: Container does not exist
354 22dab079 Antony Chazapis
        """
355 22dab079 Antony Chazapis
        return []
356 2715ade4 Sofia Papagiannaki
357 371d907a Antony Chazapis
    def list_object_meta(self, user, account, container, prefix='', delimiter=None, marker=None, limit=10000, virtual=True, domain=None, keys=[], shared=False, until=None, size_range=None):
358 371d907a Antony Chazapis
        """Return a list of object metadata dicts existing under a container.
359 2715ade4 Sofia Papagiannaki

360 371d907a Antony Chazapis
        Same parameters with list_objects. Returned dicts have no user-defined
361 371d907a Antony Chazapis
        metadata and, if until is not None, a None 'modified' timestamp.
362 2715ade4 Sofia Papagiannaki

363 15a96c3e Antony Chazapis
        Raises:
364 15a96c3e Antony Chazapis
            NotAllowedError: Operation not permitted
365 2715ade4 Sofia Papagiannaki

366 7efc9f86 Sofia Papagiannaki
            ItemNotExists: Container does not exist
367 b956618e Antony Chazapis
        """
368 b956618e Antony Chazapis
        return []
369 2715ade4 Sofia Papagiannaki
370 15a96c3e Antony Chazapis
    def list_object_permissions(self, user, account, container, prefix=''):
371 15a96c3e Antony Chazapis
        """Return a list of paths that enforce permissions under a container.
372 2715ade4 Sofia Papagiannaki

373 15a96c3e Antony Chazapis
        Raises:
374 15a96c3e Antony Chazapis
            NotAllowedError: Operation not permitted
375 15a96c3e Antony Chazapis
        """
376 15a96c3e Antony Chazapis
        return []
377 2715ade4 Sofia Papagiannaki
378 15a96c3e Antony Chazapis
    def list_object_public(self, user, account, container, prefix=''):
379 15a96c3e Antony Chazapis
        """Return a dict mapping paths to public ids for objects that are public under a container."""
380 15a96c3e Antony Chazapis
        return {}
381 2715ade4 Sofia Papagiannaki
382 82482e2c Antony Chazapis
    def get_object_meta(self, user, account, container, name, domain, version=None, include_user_defined=True):
383 cb69c154 Antony Chazapis
        """Return a dictionary with the object metadata for the domain.
384 2715ade4 Sofia Papagiannaki

385 b956618e Antony Chazapis
        The keys returned are all user-defined, except:
386 58a6c894 Antony Chazapis
            'name': The object name
387 2715ade4 Sofia Papagiannaki

388 b956618e Antony Chazapis
            'bytes': The total data size
389 2715ade4 Sofia Papagiannaki

390 66ce2ca5 Antony Chazapis
            'type': The content type
391 2715ade4 Sofia Papagiannaki

392 4a1c29ea Antony Chazapis
            'hash': The hashmap hash
393 2715ade4 Sofia Papagiannaki

394 58a6c894 Antony Chazapis
            'modified': Last modification timestamp (overall)
395 2715ade4 Sofia Papagiannaki

396 104626e3 Antony Chazapis
            'modified_by': The user that committed the object (version requested)
397 2715ade4 Sofia Papagiannaki

398 58a6c894 Antony Chazapis
            'version': The version identifier
399 2715ade4 Sofia Papagiannaki

400 58a6c894 Antony Chazapis
            'version_timestamp': The version's modification timestamp
401 2715ade4 Sofia Papagiannaki

402 25ae8b75 Antony Chazapis
            'uuid': A unique identifier that persists data or metadata updates and renames
403 2715ade4 Sofia Papagiannaki

404 33b4e4a6 Antony Chazapis
            'checksum': The MD5 sum of the object (may be empty)
405 2715ade4 Sofia Papagiannaki

406 b956618e Antony Chazapis
        Raises:
407 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
408 2715ade4 Sofia Papagiannaki

409 7efc9f86 Sofia Papagiannaki
            ItemNotExists: Container/object does not exist
410 2715ade4 Sofia Papagiannaki

411 7efc9f86 Sofia Papagiannaki
            VersionNotExists: Version does not exist
412 b956618e Antony Chazapis
        """
413 b956618e Antony Chazapis
        return {}
414 2715ade4 Sofia Papagiannaki
415 cb69c154 Antony Chazapis
    def update_object_meta(self, user, account, container, name, domain, meta, replace=False):
416 cb69c154 Antony Chazapis
        """Update the metadata associated with the object for the domain and return the new version.
417 2715ade4 Sofia Papagiannaki

418 b956618e Antony Chazapis
        Parameters:
419 cb69c154 Antony Chazapis
            'domain': Metadata domain
420 2715ade4 Sofia Papagiannaki

421 a6eb13e9 Antony Chazapis
            'meta': Dictionary with metadata to update
422 2715ade4 Sofia Papagiannaki

423 22dab079 Antony Chazapis
            'replace': Replace instead of update
424 2715ade4 Sofia Papagiannaki

425 b956618e Antony Chazapis
        Raises:
426 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
427 2715ade4 Sofia Papagiannaki

428 7efc9f86 Sofia Papagiannaki
            ItemNotExists: Container/object does not exist
429 b956618e Antony Chazapis
        """
430 02c4d2ba Antony Chazapis
        return ''
431 2715ade4 Sofia Papagiannaki
432 3436eeb0 Antony Chazapis
    def get_object_permissions(self, user, account, container, name):
433 067cf1fc Antony Chazapis
        """Return the action allowed on the object, the path
434 067cf1fc Antony Chazapis
        from which the object gets its permissions from,
435 cca6c617 Antony Chazapis
        along with a dictionary containing the permissions.
436 2715ade4 Sofia Papagiannaki

437 067cf1fc Antony Chazapis
        The dictionary keys are (also used for defining the action):
438 3436eeb0 Antony Chazapis
            'read': The object is readable by the users/groups in the list
439 2715ade4 Sofia Papagiannaki

440 3436eeb0 Antony Chazapis
            'write': The object is writable by the users/groups in the list
441 2715ade4 Sofia Papagiannaki

442 3436eeb0 Antony Chazapis
        Raises:
443 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
444 2715ade4 Sofia Papagiannaki

445 7efc9f86 Sofia Papagiannaki
            ItemNotExists: Container/object does not exist
446 3436eeb0 Antony Chazapis
        """
447 3436eeb0 Antony Chazapis
        return {}
448 2715ade4 Sofia Papagiannaki
449 3436eeb0 Antony Chazapis
    def update_object_permissions(self, user, account, container, name, permissions):
450 345dcf39 Antony Chazapis
        """Update (set) the permissions associated with the object.
451 2715ade4 Sofia Papagiannaki

452 3436eeb0 Antony Chazapis
        Parameters:
453 345dcf39 Antony Chazapis
            'permissions': Dictionary with permissions to set
454 2715ade4 Sofia Papagiannaki

455 3436eeb0 Antony Chazapis
        Raises:
456 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
457 2715ade4 Sofia Papagiannaki

458 7efc9f86 Sofia Papagiannaki
            ItemNotExists: Container/object does not exist
459 2715ade4 Sofia Papagiannaki

460 3436eeb0 Antony Chazapis
            ValueError: Invalid users/groups in permissions
461 3436eeb0 Antony Chazapis
        """
462 3436eeb0 Antony Chazapis
        return
463 2715ade4 Sofia Papagiannaki
464 02c0c3fa Antony Chazapis
    def get_object_public(self, user, account, container, name):
465 bb4eafc6 Antony Chazapis
        """Return the public id of the object if applicable.
466 2715ade4 Sofia Papagiannaki

467 02c0c3fa Antony Chazapis
        Raises:
468 02c0c3fa Antony Chazapis
            NotAllowedError: Operation not permitted
469 2715ade4 Sofia Papagiannaki

470 7efc9f86 Sofia Papagiannaki
            ItemNotExists: Container/object does not exist
471 02c0c3fa Antony Chazapis
        """
472 02c0c3fa Antony Chazapis
        return None
473 2715ade4 Sofia Papagiannaki
474 02c0c3fa Antony Chazapis
    def update_object_public(self, user, account, container, name, public):
475 02c0c3fa Antony Chazapis
        """Update the public status of the object.
476 2715ade4 Sofia Papagiannaki

477 02c0c3fa Antony Chazapis
        Parameters:
478 02c0c3fa Antony Chazapis
            'public': Boolean value
479 2715ade4 Sofia Papagiannaki

480 02c0c3fa Antony Chazapis
        Raises:
481 02c0c3fa Antony Chazapis
            NotAllowedError: Operation not permitted
482 2715ade4 Sofia Papagiannaki

483 7efc9f86 Sofia Papagiannaki
            ItemNotExists: Container/object does not exist
484 02c0c3fa Antony Chazapis
        """
485 02c0c3fa Antony Chazapis
        return
486 2715ade4 Sofia Papagiannaki
487 83dd59c5 Antony Chazapis
    def get_object_hashmap(self, user, account, container, name, version=None):
488 22dab079 Antony Chazapis
        """Return the object's size and a list with partial hashes.
489 2715ade4 Sofia Papagiannaki

490 b956618e Antony Chazapis
        Raises:
491 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
492 2715ade4 Sofia Papagiannaki

493 7efc9f86 Sofia Papagiannaki
            ItemNotExists: Container/object does not exist
494 2715ade4 Sofia Papagiannaki

495 7efc9f86 Sofia Papagiannaki
            VersionNotExists: Version does not exist
496 b956618e Antony Chazapis
        """
497 22dab079 Antony Chazapis
        return 0, []
498 2715ade4 Sofia Papagiannaki
499 33b4e4a6 Antony Chazapis
    def update_object_hashmap(self, user, account, container, name, size, type, hashmap, checksum, domain, meta={}, replace_meta=False, permissions=None):
500 02c4d2ba Antony Chazapis
        """Create/update an object with the specified size and partial hashes and return the new version.
501 2715ade4 Sofia Papagiannaki

502 3436eeb0 Antony Chazapis
        Parameters:
503 cb69c154 Antony Chazapis
            'domain': Metadata domain
504 2715ade4 Sofia Papagiannaki

505 cb69c154 Antony Chazapis
            'meta': Dictionary with metadata to change
506 2715ade4 Sofia Papagiannaki

507 3436eeb0 Antony Chazapis
            'replace_meta': Replace metadata instead of update
508 2715ade4 Sofia Papagiannaki

509 3436eeb0 Antony Chazapis
            'permissions': Updated object permissions
510 2715ade4 Sofia Papagiannaki

511 b956618e Antony Chazapis
        Raises:
512 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
513 2715ade4 Sofia Papagiannaki

514 7efc9f86 Sofia Papagiannaki
            ItemNotExists: Container does not exist
515 2715ade4 Sofia Papagiannaki

516 3436eeb0 Antony Chazapis
            ValueError: Invalid users/groups in permissions
517 2715ade4 Sofia Papagiannaki

518 5df6c6d1 Antony Chazapis
            QuotaError: Account or container quota exceeded
519 b956618e Antony Chazapis
        """
520 02c4d2ba Antony Chazapis
        return ''
521 2715ade4 Sofia Papagiannaki
522 33b4e4a6 Antony Chazapis
    def update_object_checksum(self, user, account, container, name, version, checksum):
523 33b4e4a6 Antony Chazapis
        """Update an object's checksum."""
524 33b4e4a6 Antony Chazapis
        return
525 2715ade4 Sofia Papagiannaki
526 4d15c94e Sofia Papagiannaki
    def copy_object(self, user, src_account, src_container, src_name, dest_account, dest_container, dest_name, type, domain, meta={}, replace_meta=False, permissions=None, src_version=None, delimiter=None):
527 02c4d2ba Antony Chazapis
        """Copy an object's data and metadata and return the new version.
528 2715ade4 Sofia Papagiannaki

529 b956618e Antony Chazapis
        Parameters:
530 cb69c154 Antony Chazapis
            'domain': Metadata domain
531 2715ade4 Sofia Papagiannaki

532 cb69c154 Antony Chazapis
            'meta': Dictionary with metadata to change from source to destination
533 2715ade4 Sofia Papagiannaki

534 22dab079 Antony Chazapis
            'replace_meta': Replace metadata instead of update
535 2715ade4 Sofia Papagiannaki

536 3436eeb0 Antony Chazapis
            'permissions': New object permissions
537 2715ade4 Sofia Papagiannaki

538 3436eeb0 Antony Chazapis
            'src_version': Copy from the version provided
539 2715ade4 Sofia Papagiannaki

540 4d15c94e Sofia Papagiannaki
            'delimiter': Copy objects whose path starts with src_name + delimiter
541 2715ade4 Sofia Papagiannaki

542 b956618e Antony Chazapis
        Raises:
543 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
544 2715ade4 Sofia Papagiannaki

545 7efc9f86 Sofia Papagiannaki
            ItemNotExists: Container/object does not exist
546 2715ade4 Sofia Papagiannaki

547 7efc9f86 Sofia Papagiannaki
            VersionNotExists: Version does not exist
548 2715ade4 Sofia Papagiannaki

549 3436eeb0 Antony Chazapis
            ValueError: Invalid users/groups in permissions
550 2715ade4 Sofia Papagiannaki

551 5df6c6d1 Antony Chazapis
            QuotaError: Account or container quota exceeded
552 b956618e Antony Chazapis
        """
553 02c4d2ba Antony Chazapis
        return ''
554 2715ade4 Sofia Papagiannaki
555 4d15c94e Sofia Papagiannaki
    def move_object(self, user, src_account, src_container, src_name, dest_account, dest_container, dest_name, type, domain, meta={}, replace_meta=False, permissions=None, delimiter=None):
556 02c4d2ba Antony Chazapis
        """Move an object's data and metadata and return the new version.
557 2715ade4 Sofia Papagiannaki

558 b956618e Antony Chazapis
        Parameters:
559 cb69c154 Antony Chazapis
            'domain': Metadata domain
560 2715ade4 Sofia Papagiannaki

561 cb69c154 Antony Chazapis
            'meta': Dictionary with metadata to change from source to destination
562 2715ade4 Sofia Papagiannaki

563 22dab079 Antony Chazapis
            'replace_meta': Replace metadata instead of update
564 2715ade4 Sofia Papagiannaki

565 3436eeb0 Antony Chazapis
            'permissions': New object permissions
566 2715ade4 Sofia Papagiannaki

567 4d15c94e Sofia Papagiannaki
            'delimiter': Move objects whose path starts with src_name + delimiter
568 2715ade4 Sofia Papagiannaki

569 b956618e Antony Chazapis
        Raises:
570 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
571 2715ade4 Sofia Papagiannaki

572 7efc9f86 Sofia Papagiannaki
            ItemNotExists: Container/object does not exist
573 2715ade4 Sofia Papagiannaki

574 3436eeb0 Antony Chazapis
            ValueError: Invalid users/groups in permissions
575 2715ade4 Sofia Papagiannaki

576 5df6c6d1 Antony Chazapis
            QuotaError: Account or container quota exceeded
577 b956618e Antony Chazapis
        """
578 02c4d2ba Antony Chazapis
        return ''
579 2715ade4 Sofia Papagiannaki
580 4d15c94e Sofia Papagiannaki
    def delete_object(self, user, account, container, name, until=None, delimiter=None):
581 84846143 Antony Chazapis
        """Delete/purge an object.
582 2715ade4 Sofia Papagiannaki

583 4d15c94e Sofia Papagiannaki
        Parameters:
584 4d15c94e Sofia Papagiannaki
            'delimiter': Delete objects whose path starting with name + delimiter
585 2715ade4 Sofia Papagiannaki

586 b956618e Antony Chazapis
        Raises:
587 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
588 2715ade4 Sofia Papagiannaki

589 7efc9f86 Sofia Papagiannaki
            ItemNotExists: Container/object does not exist
590 b956618e Antony Chazapis
        """
591 b956618e Antony Chazapis
        return
592 2715ade4 Sofia Papagiannaki
593 83dd59c5 Antony Chazapis
    def list_versions(self, user, account, container, name):
594 cca6c617 Antony Chazapis
        """Return a list of all (version, version_timestamp) tuples for an object.
595 2715ade4 Sofia Papagiannaki

596 cca6c617 Antony Chazapis
        Raises:
597 cca6c617 Antony Chazapis
            NotAllowedError: Operation not permitted
598 cca6c617 Antony Chazapis
        """
599 58a6c894 Antony Chazapis
        return []
600 2715ade4 Sofia Papagiannaki
601 37bee317 Antony Chazapis
    def get_uuid(self, user, uuid):
602 37bee317 Antony Chazapis
        """Return the (account, container, name) for the UUID given.
603 2715ade4 Sofia Papagiannaki

604 37bee317 Antony Chazapis
        Raises:
605 37bee317 Antony Chazapis
            NotAllowedError: Operation not permitted
606 2715ade4 Sofia Papagiannaki

607 37bee317 Antony Chazapis
            NameError: UUID does not exist
608 37bee317 Antony Chazapis
        """
609 37bee317 Antony Chazapis
        return None
610 2715ade4 Sofia Papagiannaki
611 bb4eafc6 Antony Chazapis
    def get_public(self, user, public):
612 bb4eafc6 Antony Chazapis
        """Return the (account, container, name) for the public id given.
613 2715ade4 Sofia Papagiannaki

614 bb4eafc6 Antony Chazapis
        Raises:
615 bb4eafc6 Antony Chazapis
            NotAllowedError: Operation not permitted
616 2715ade4 Sofia Papagiannaki

617 bb4eafc6 Antony Chazapis
            NameError: Public id does not exist
618 bb4eafc6 Antony Chazapis
        """
619 bb4eafc6 Antony Chazapis
        return None
620 2715ade4 Sofia Papagiannaki
621 22dab079 Antony Chazapis
    def get_block(self, hash):
622 22dab079 Antony Chazapis
        """Return a block's data.
623 2715ade4 Sofia Papagiannaki

624 22dab079 Antony Chazapis
        Raises:
625 7efc9f86 Sofia Papagiannaki
            ItemNotExists: Block does not exist
626 22dab079 Antony Chazapis
        """
627 22dab079 Antony Chazapis
        return ''
628 2715ade4 Sofia Papagiannaki
629 22dab079 Antony Chazapis
    def put_block(self, data):
630 22dab079 Antony Chazapis
        """Store a block and return the hash."""
631 22dab079 Antony Chazapis
        return 0
632 2715ade4 Sofia Papagiannaki
633 22dab079 Antony Chazapis
    def update_block(self, hash, data, offset=0):
634 22dab079 Antony Chazapis
        """Update a known block and return the hash.
635 2715ade4 Sofia Papagiannaki

636 22dab079 Antony Chazapis
        Raises:
637 22dab079 Antony Chazapis
            IndexError: Offset or data outside block limits
638 22dab079 Antony Chazapis
        """
639 22dab079 Antony Chazapis
        return 0