Revision cb69c154

b/pithos/backends/base.py
73 73
        """
74 74
        return []
75 75
    
76
    def get_account_meta(self, user, account, until=None):
77
        """Return a dictionary with the account metadata.
76
    def get_account_meta(self, user, account, domain, until=None):
77
        """Return a dictionary with the account metadata for the domain.
78 78
        
79 79
        The keys returned are all user-defined, except:
80 80
            'name': The account name
......
92 92
        """
93 93
        return {}
94 94
    
95
    def update_account_meta(self, user, account, meta, replace=False):
96
        """Update the metadata associated with the account.
95
    def update_account_meta(self, user, account, domain, meta, replace=False):
96
        """Update the metadata associated with the account for the domain.
97 97
        
98 98
        Parameters:
99
            'domain': Metadata domain
100
            
99 101
            'meta': Dictionary with metadata to update
100 102
            
101 103
            'replace': Replace instead of update
......
182 184
        """
183 185
        return []
184 186
    
185
    def get_container_meta(self, user, account, container, until=None):
186
        """Return a dictionary with the container metadata.
187
    def get_container_meta(self, user, account, container, domain, until=None):
188
        """Return a dictionary with the container metadata for the domain.
187 189
        
188 190
        The keys returned are all user-defined, except:
189 191
            'name': The container name
......
203 205
        """
204 206
        return {}
205 207
    
206
    def update_container_meta(self, user, account, container, meta, replace=False):
207
        """Update the metadata associated with the container.
208
    def update_container_meta(self, user, account, container, domain, meta, replace=False):
209
        """Update the metadata associated with the container for the domain.
208 210
        
209 211
        Parameters:
212
            'domain': Metadata domain
213
            
210 214
            'meta': Dictionary with metadata to update
211 215
            
212 216
            'replace': Replace instead of update
......
269 273
        """
270 274
        return
271 275
    
272
    def list_objects(self, user, account, container, prefix='', delimiter=None, marker=None, limit=10000, virtual=True, keys=[], shared=False, until=None):
276
    def list_objects(self, user, account, container, prefix='', delimiter=None, marker=None, limit=10000, virtual=True, domain=None, keys=[], shared=False, until=None):
273 277
        """Return a list of object (name, version_id) tuples existing under a container.
274 278
        
275 279
        Parameters:
......
287 291
                       If set, the result will include all names after 'prefix',
288 292
                       up to and including the 'delimiter' if it is found
289 293
            
294
            'domain': Metadata domain for keys
295
            
290 296
            'keys': Include objects that satisfy the key queries in the list.
291 297
                    Use 'key', '!key' for existence queries, 'key op value' for
292 298
                    value queries, where 'op' can be one of =, !=, <=, >=, <, >
......
300 306
        """
301 307
        return []
302 308
    
303
    def list_object_meta(self, user, account, container, until=None):
304
        """Return a list with all the container's object meta keys.
309
    def list_object_meta(self, user, account, container, domain, until=None):
310
        """Return a list with all the container's object meta keys for the domain.
305 311
        
306 312
        Raises:
307 313
            NotAllowedError: Operation not permitted
......
310 316
        """
311 317
        return []
312 318
    
313
    def get_object_meta(self, user, account, container, name, version=None):
314
        """Return a dictionary with the object metadata.
319
    def get_object_meta(self, user, account, container, name, domain, version=None):
320
        """Return a dictionary with the object metadata for the domain.
315 321
        
316 322
        The keys returned are all user-defined, except:
317 323
            'name': The object name
......
337 343
        """
338 344
        return {}
339 345
    
340
    def update_object_meta(self, user, account, container, name, meta, replace=False):
341
        """Update the metadata associated with the object and return the new version.
346
    def update_object_meta(self, user, account, container, name, domain, meta, replace=False):
347
        """Update the metadata associated with the object for the domain and return the new version.
342 348
        
343 349
        Parameters:
350
            'domain': Metadata domain
351
            
344 352
            'meta': Dictionary with metadata to update
345 353
            
346 354
            'replace': Replace instead of update
......
424 432
        """
425 433
        return 0, []
426 434
    
427
    def update_object_hashmap(self, user, account, container, name, size, hashmap, meta={}, replace_meta=False, permissions=None):
435
    def update_object_hashmap(self, user, account, container, name, size, hashmap, domain, meta={}, replace_meta=False, permissions=None):
428 436
        """Create/update an object with the specified size and partial hashes and return the new version.
429 437
        
430 438
        Parameters:
431
            'dest_meta': Dictionary with metadata to change
439
            'domain': Metadata domain
440
            
441
            'meta': Dictionary with metadata to change
432 442
            
433 443
            'replace_meta': Replace metadata instead of update
434 444
            
......
447 457
        """
448 458
        return ''
449 459
    
450
    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):
460
    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):
451 461
        """Copy an object's data and metadata and return the new version.
452 462
        
453 463
        Parameters:
454
            'dest_meta': Dictionary with metadata to change from source to destination
464
            'domain': Metadata domain
465
            
466
            'meta': Dictionary with metadata to change from source to destination
455 467
            
456 468
            'replace_meta': Replace metadata instead of update
457 469
            
......
474 486
        """
475 487
        return ''
476 488
    
477
    def move_object(self, user, src_account, src_container, src_name, dest_account, dest_container, dest_name, dest_meta={}, replace_meta=False, permissions=None):
489
    def move_object(self, user, src_account, src_container, src_name, dest_account, dest_container, dest_name, domain, meta={}, replace_meta=False, permissions=None):
478 490
        """Move an object's data and metadata and return the new version.
479 491
        
480 492
        Parameters:
481
            'dest_meta': Dictionary with metadata to change from source to destination
493
            'domain': Metadata domain
494
            
495
            'meta': Dictionary with metadata to change from source to destination
482 496
            
483 497
            'replace_meta': Replace metadata instead of update
484 498
            
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