コード例 #1
0
    def list(self,
             project=None,
             marker=None,
             limit=storage.DEFAULT_QUEUES_PER_PAGE,
             detailed=False):

        query = utils.scoped_query(marker, project)

        fields = {'p_q': 1, '_id': 0}
        if detailed:
            fields['m'] = 1

        cursor = self._collection.find(query, fields=fields)
        cursor = cursor.limit(limit).sort('p_q')
        marker_name = {}

        def normalizer(record):
            queue = {'name': utils.descope_queue_name(record['p_q'])}
            marker_name['next'] = queue['name']
            if detailed:
                queue['metadata'] = record['m']
            return queue

        yield utils.HookedCursor(cursor, normalizer)
        yield marker_name and marker_name['next']
コード例 #2
0
ファイル: queues.py プロジェクト: AndreMouche/marconi
    def list(self, project=None, marker=None,
             limit=None, detailed=False):

        if limit is None:
            limit = self.driver.limits_conf.default_queue_paging

        query = utils.scoped_query(marker, project)

        fields = {'p_q': 1, '_id': 0}
        if detailed:
            fields['m'] = 1

        cursor = self._collection.find(query, fields=fields)
        cursor = cursor.limit(limit).sort('p_q')
        marker_name = {}

        def normalizer(record):
            queue = {'name': utils.descope_queue_name(record['p_q'])}
            marker_name['next'] = queue['name']
            if detailed:
                queue['metadata'] = record['m']
            return queue

        yield utils.HookedCursor(cursor, normalizer)
        yield marker_name and marker_name['next']
コード例 #3
0
    def list(self, project):
        fields = {'_id': 0}

        query = utils.scoped_query(None, project)
        return utils.HookedCursor(self._col.find(query, fields), _normalize)
コード例 #4
0
    def list(self, project):
        fields = {'_id': 0}

        query = utils.scoped_query(None, project)
        return utils.HookedCursor(self._col.find(query, fields),
                                  _normalize)