Revision 39ef6f41 snf-pithos-backend/pithos/backends/modular.py
b/snf-pithos-backend/pithos/backends/modular.py | ||
---|---|---|
77 | 77 |
#DEFAULT_QUEUE_MODULE = 'pithos.backends.lib.rabbitmq' |
78 | 78 |
#DEFAULT_QUEUE_CONNECTION = 'rabbitmq://guest:guest@localhost:5672/pithos' |
79 | 79 |
|
80 |
QUEUE_MESSAGE_KEY = '#'
|
|
81 |
QUEUE_CLIENT_ID = 2 # Pithos.
|
|
80 |
QUEUE_MESSAGE_KEY = 'pithos'
|
|
81 |
QUEUE_CLIENT_ID = 'pithos'
|
|
82 | 82 |
|
83 | 83 |
( CLUSTER_NORMAL, CLUSTER_HISTORY, CLUSTER_DELETED ) = range(3) |
84 | 84 |
|
... | ... | |
101 | 101 |
def fn(self, *args, **kw): |
102 | 102 |
self.wrapper.execute() |
103 | 103 |
try: |
104 |
self.messages = [] |
|
104 | 105 |
ret = func(self, *args, **kw) |
105 | 106 |
self.wrapper.commit() |
107 |
for m in self.messages: |
|
108 |
self.queue.send(*m) |
|
106 | 109 |
return ret |
107 | 110 |
except: |
108 | 111 |
self.wrapper.rollback() |
... | ... | |
668 | 671 |
|
669 | 672 |
if permissions is not None: |
670 | 673 |
self.permissions.access_set(path, permissions) |
674 |
|
|
675 |
self._report_object_change(user, account, path, details={'version': dest_version_id, 'action': 'object update'}) |
|
671 | 676 |
return dest_version_id |
672 | 677 |
|
673 | 678 |
@backend_method |
... | ... | |
769 | 774 |
del_size = self._apply_versioning(account, container, src_version_id) |
770 | 775 |
if del_size: |
771 | 776 |
self._report_size_change(user, account, -del_size, {'action': 'object delete'}) |
777 |
self._report_object_change(user, account, path, details={'action': 'object delete'}) |
|
772 | 778 |
self.permissions.access_clear(path) |
773 | 779 |
|
774 | 780 |
@backend_method |
... | ... | |
1005 | 1011 |
account_node = self._lookup_account(account, True)[1] |
1006 | 1012 |
total = self._get_statistics(account_node)[1] |
1007 | 1013 |
details.update({'user': user, 'total': total}) |
1008 |
self.queue.send(account, 'diskspace', size, details) |
|
1014 |
self.messages.append((account, 'diskspace', size, details)) |
|
1015 |
|
|
1016 |
def _report_object_change(self, user, account, path, details={}): |
|
1017 |
logger.debug("_report_object_change: %s %s %s %s", user, account, path, details) |
|
1018 |
details.update({'user': user}) |
|
1019 |
self.messages.append((account, 'object', path, details)) |
|
1009 | 1020 |
|
1010 | 1021 |
# Policy functions. |
1011 | 1022 |
|
Also available in: Unified diff