Revision cb69c154 pithos/backends/modular.py
b/pithos/backends/modular.py | ||
---|---|---|
119 | 119 |
return allowed[start:start + limit] |
120 | 120 |
|
121 | 121 |
@backend_method |
122 |
def get_account_meta(self, user, account, until=None): |
|
123 |
"""Return a dictionary with the account metadata.""" |
|
122 |
def get_account_meta(self, user, account, domain, until=None):
|
|
123 |
"""Return a dictionary with the account metadata for the domain."""
|
|
124 | 124 |
|
125 |
logger.debug("get_account_meta: %s %s", account, until)
|
|
125 |
logger.debug("get_account_meta: %s %s %s", account, domain, until)
|
|
126 | 126 |
path, node = self._lookup_account(account, user == account) |
127 | 127 |
if user != account: |
128 | 128 |
if until or node is None or account not in self._allowed_accounts(user): |
... | ... | |
154 | 154 |
return meta |
155 | 155 |
|
156 | 156 |
@backend_method |
157 |
def update_account_meta(self, user, account, meta, replace=False): |
|
158 |
"""Update the metadata associated with the account.""" |
|
157 |
def update_account_meta(self, user, account, domain, meta, replace=False):
|
|
158 |
"""Update the metadata associated with the account for the domain."""
|
|
159 | 159 |
|
160 |
logger.debug("update_account_meta: %s %s %s", account, meta, replace)
|
|
160 |
logger.debug("update_account_meta: %s %s %s %s", account, domain, meta, replace)
|
|
161 | 161 |
if user != account: |
162 | 162 |
raise NotAllowedError |
163 | 163 |
path, node = self._lookup_account(account, True) |
... | ... | |
264 | 264 |
return [x[0] for x in self._list_objects(node, account, '', '/', marker, limit, False, [], until)] |
265 | 265 |
|
266 | 266 |
@backend_method |
267 |
def get_container_meta(self, user, account, container, until=None): |
|
268 |
"""Return a dictionary with the container metadata.""" |
|
267 |
def get_container_meta(self, user, account, container, domain, until=None):
|
|
268 |
"""Return a dictionary with the container metadata for the domain."""
|
|
269 | 269 |
|
270 |
logger.debug("get_container_meta: %s %s %s", account, container, until)
|
|
270 |
logger.debug("get_container_meta: %s %s %s %s", account, container, domain, until)
|
|
271 | 271 |
if user != account: |
272 | 272 |
if until or container not in self._allowed_containers(user, account): |
273 | 273 |
raise NotAllowedError |
... | ... | |
293 | 293 |
return meta |
294 | 294 |
|
295 | 295 |
@backend_method |
296 |
def update_container_meta(self, user, account, container, meta, replace=False): |
|
297 |
"""Update the metadata associated with the container.""" |
|
296 |
def update_container_meta(self, user, account, container, domain, meta, replace=False):
|
|
297 |
"""Update the metadata associated with the container for the domain."""
|
|
298 | 298 |
|
299 |
logger.debug("update_container_meta: %s %s %s %s", account, container, meta, replace)
|
|
299 |
logger.debug("update_container_meta: %s %s %s %s %s", account, container, domain, meta, replace)
|
|
300 | 300 |
if user != account: |
301 | 301 |
raise NotAllowedError |
302 | 302 |
path, node = self._lookup_container(account, container) |
... | ... | |
369 | 369 |
self.node.node_remove(node) |
370 | 370 |
|
371 | 371 |
@backend_method |
372 |
def list_objects(self, user, account, container, prefix='', delimiter=None, marker=None, limit=10000, virtual=True, keys=[], shared=False, until=None): |
|
372 |
def list_objects(self, user, account, container, prefix='', delimiter=None, marker=None, limit=10000, virtual=True, domain=None, keys=[], shared=False, until=None):
|
|
373 | 373 |
"""Return a list of objects existing under a container.""" |
374 | 374 |
|
375 |
logger.debug("list_objects: %s %s %s %s %s %s %s %s %s %s", account, container, prefix, delimiter, marker, limit, virtual, keys, shared, until)
|
|
375 |
logger.debug("list_objects: %s %s %s %s %s %s %s %s %s %s %s", account, container, prefix, delimiter, marker, limit, virtual, domain, keys, shared, until)
|
|
376 | 376 |
allowed = [] |
377 | 377 |
if user != account: |
378 | 378 |
if until: |
... | ... | |
389 | 389 |
return self._list_objects(node, path, prefix, delimiter, marker, limit, virtual, keys, until, allowed) |
390 | 390 |
|
391 | 391 |
@backend_method |
392 |
def list_object_meta(self, user, account, container, until=None): |
|
393 |
"""Return a list with all the container's object meta keys.""" |
|
392 |
def list_object_meta(self, user, account, container, domain, until=None):
|
|
393 |
"""Return a list with all the container's object meta keys for the domain."""
|
|
394 | 394 |
|
395 |
logger.debug("list_object_meta: %s %s %s", account, container, until)
|
|
395 |
logger.debug("list_object_meta: %s %s %s %s", account, container, domain, until)
|
|
396 | 396 |
allowed = [] |
397 | 397 |
if user != account: |
398 | 398 |
if until: |
... | ... | |
405 | 405 |
return self.node.latest_attribute_keys(node, before, CLUSTER_DELETED, allowed) |
406 | 406 |
|
407 | 407 |
@backend_method |
408 |
def get_object_meta(self, user, account, container, name, version=None): |
|
409 |
"""Return a dictionary with the object metadata.""" |
|
408 |
def get_object_meta(self, user, account, container, name, domain, version=None):
|
|
409 |
"""Return a dictionary with the object metadata for the domain."""
|
|
410 | 410 |
|
411 |
logger.debug("get_object_meta: %s %s %s %s", account, container, name, version)
|
|
411 |
logger.debug("get_object_meta: %s %s %s %s %s", account, container, name, domain, version)
|
|
412 | 412 |
self._can_read(user, account, container, name) |
413 | 413 |
path, node = self._lookup_object(account, container, name) |
414 | 414 |
props = self._get_version(node, version) |
... | ... | |
430 | 430 |
return meta |
431 | 431 |
|
432 | 432 |
@backend_method |
433 |
def update_object_meta(self, user, account, container, name, meta, replace=False): |
|
434 |
"""Update the metadata associated with the object.""" |
|
433 |
def update_object_meta(self, user, account, container, name, domain, meta, replace=False):
|
|
434 |
"""Update the metadata associated with the object for the domain and return the new version."""
|
|
435 | 435 |
|
436 |
logger.debug("update_object_meta: %s %s %s %s %s", account, container, name, meta, replace)
|
|
436 |
logger.debug("update_object_meta: %s %s %s %s %s %s", account, container, name, domain, meta, replace)
|
|
437 | 437 |
self._can_write(user, account, container, name) |
438 | 438 |
path, node = self._lookup_object(account, container, name) |
439 | 439 |
src_version_id, dest_version_id = self._put_metadata(user, node, meta, replace) |
... | ... | |
537 | 537 |
return dest_version_id |
538 | 538 |
|
539 | 539 |
@backend_method |
540 |
def update_object_hashmap(self, user, account, container, name, size, hashmap, meta={}, replace_meta=False, permissions=None): |
|
540 |
def update_object_hashmap(self, user, account, container, name, size, hashmap, domain, meta={}, replace_meta=False, permissions=None):
|
|
541 | 541 |
"""Create/update an object with the specified size and partial hashes.""" |
542 | 542 |
|
543 | 543 |
logger.debug("update_object_hashmap: %s %s %s %s %s", account, container, name, size, hashmap) |
... | ... | |
578 | 578 |
return dest_version_id |
579 | 579 |
|
580 | 580 |
@backend_method |
581 |
def copy_object(self, user, src_account, src_container, src_name, dest_account, dest_container, dest_name, dest_meta={}, replace_meta=False, permissions=None, src_version=None):
|
|
581 |
def copy_object(self, user, src_account, src_container, src_name, dest_account, dest_container, dest_name, domain, meta={}, replace_meta=False, permissions=None, src_version=None):
|
|
582 | 582 |
"""Copy an object's data and metadata.""" |
583 | 583 |
|
584 |
logger.debug("copy_object: %s %s %s %s %s %s %s %s %s %s", src_account, src_container, src_name, dest_account, dest_container, dest_name, dest_meta, replace_meta, permissions, src_version)
|
|
584 |
logger.debug("copy_object: %s %s %s %s %s %s %s %s %s %s %s", src_account, src_container, src_name, dest_account, dest_container, dest_name, domain, meta, replace_meta, permissions, src_version)
|
|
585 | 585 |
return self._copy_object(user, src_account, src_container, src_name, dest_account, dest_container, dest_name, dest_meta, replace_meta, permissions, src_version) |
586 | 586 |
|
587 | 587 |
@backend_method |
588 |
def move_object(self, user, src_account, src_container, src_name, dest_account, dest_container, dest_name, dest_meta={}, replace_meta=False, permissions=None):
|
|
588 |
def move_object(self, user, src_account, src_container, src_name, dest_account, dest_container, dest_name, domain, meta={}, replace_meta=False, permissions=None):
|
|
589 | 589 |
"""Move an object's data and metadata.""" |
590 | 590 |
|
591 |
logger.debug("move_object: %s %s %s %s %s %s %s %s %s", src_account, src_container, src_name, dest_account, dest_container, dest_name, dest_meta, replace_meta, permissions)
|
|
591 |
logger.debug("move_object: %s %s %s %s %s %s %s %s %s %s", src_account, src_container, src_name, dest_account, dest_container, dest_name, domain, meta, replace_meta, permissions)
|
|
592 | 592 |
if user != src_account: |
593 | 593 |
raise NotAllowedError |
594 |
dest_version_id = self._copy_object(user, src_account, src_container, src_name, dest_account, dest_container, dest_name, dest_meta, replace_meta, permissions, None)
|
|
594 |
dest_version_id = self._copy_object(user, src_account, src_container, src_name, dest_account, dest_container, dest_name, meta, replace_meta, permissions, None) |
|
595 | 595 |
if (src_account, src_container, src_name) != (dest_account, dest_container, dest_name): |
596 | 596 |
self._delete_object(user, src_account, src_container, src_name) |
597 | 597 |
return dest_version_id |
Also available in: Unified diff