~hudson-openstack/burrow/trunk

« back to all changes in this revision

Viewing changes to burrow/backend/memory.py

  • Committer: Tarmac
  • Author(s): Eric Day
  • Date: 2011-08-10 07:28:01 UTC
  • mfrom: (16.3.24 backend-unittests)
  • Revision ID: tarmac-20110810072801-32ue4p8boiepxhjg
Pushed wait functionality down into backend, removed frontend tests since this is replaced with HTTP backend test now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
            if detail is not None:
68
68
                yield queue.detail(detail)
69
69
 
 
70
    @burrow.backend.wait_without_attributes
70
71
    def delete_messages(self, account, queue, filters={}):
71
72
        account, queue = self.accounts.get_queue(account, queue)
72
73
        detail = self._get_message_detail(filters)
77
78
        if queue.messages.count() == 0:
78
79
            self.accounts.delete_queue(account.id, queue.id)
79
80
 
 
81
    @burrow.backend.wait_without_attributes
80
82
    def get_messages(self, account, queue, filters={}):
81
83
        account, queue = self.accounts.get_queue(account, queue)
82
84
        detail = self._get_message_detail(filters, 'all')
84
86
            if detail is not None:
85
87
                yield message.detail(detail)
86
88
 
 
89
    @burrow.backend.wait_with_attributes
87
90
    def update_messages(self, account, queue, attributes, filters={}):
88
91
        account, queue = self.accounts.get_queue(account, queue)
89
92
        notify = False
99
102
            if detail is not None:
100
103
                yield message.detail(detail)
101
104
        if notify:
102
 
            self.notify(account.id, queue.id)
 
105
            self._notify(account.id, queue.id)
103
106
 
104
107
    def create_message(self, account, queue, message, body, attributes={}):
105
108
        account, queue = self.accounts.get_queue(account, queue, True)
114
117
        message.hide = hide
115
118
        message.body = body
116
119
        if created or hide == 0:
117
 
            self.notify(account.id, queue.id)
 
120
            self._notify(account.id, queue.id)
118
121
        return created
119
122
 
120
123
    def delete_message(self, account, queue, message, filters={}):
142
145
        if hide is not None:
143
146
            message.hide = hide
144
147
            if hide == 0:
145
 
                self.notify(account.id, queue.id)
 
148
                self._notify(account.id, queue.id)
146
149
        return message.detail(detail)
147
150
 
148
151
    def clean(self):
157
160
                        message.hide = 0
158
161
                        notify = True
159
162
                if notify:
160
 
                    self.notify(account.id, queue.id)
 
163
                    self._notify(account.id, queue.id)
161
164
                if queue.messages.count() == 0:
162
165
                    self.accounts.delete_queue(account.id, queue.id)
163
166