예제 #1
0
파일: pooling.py 프로젝트: xglhjk6/zaqar
    def _list(self, project=None, marker=None,
              limit=storage.DEFAULT_QUEUES_PER_PAGE, detailed=False):

        def all_pages():
            yield next(self._mgt_queue_ctrl.list(
                project=project,
                marker=marker,
                limit=limit,
                detailed=detailed))

        # make a heap compared with 'name'
        ls = heapq.merge(*[
            utils.keyify('name', page)
            for page in all_pages()
        ])

        marker_name = {}

        # limit the iterator and strip out the comparison wrapper
        def it():
            for queue_cmp in itertools.islice(ls, limit):
                marker_name['next'] = queue_cmp.obj['name']
                yield queue_cmp.obj

        yield it()
        yield marker_name and marker_name['next']
예제 #2
0
파일: pooling.py 프로젝트: AvnishPal/zaqar
    def _list(self, project=None, marker=None,
              limit=storage.DEFAULT_QUEUES_PER_PAGE, detailed=False):

        def all_pages():
            pool = self._pool_catalog.get_default_pool()
            if pool is None:
                raise errors.NoPoolFound()
            yield next(pool.queue_controller.list(
                project=project,
                marker=marker,
                limit=limit,
                detailed=detailed))

        # make a heap compared with 'name'
        ls = heapq.merge(*[
            utils.keyify('name', page)
            for page in all_pages()
        ])

        marker_name = {}

        # limit the iterator and strip out the comparison wrapper
        def it():
            for queue_cmp in itertools.islice(ls, limit):
                marker_name['next'] = queue_cmp.obj['name']
                yield queue_cmp.obj

        yield it()
        yield marker_name and marker_name['next']
예제 #3
0
파일: pooling.py 프로젝트: wenchma/zaqar
    def _list(self, project=None, marker=None,
              limit=storage.DEFAULT_QUEUES_PER_PAGE, detailed=False):

        def all_pages():
            cursor = self._pool_catalog._pools_ctrl.list(limit=0)
            for pool in next(cursor):
                yield next(self._pool_catalog.get_driver(pool['name'])
                           .queue_controller.list(
                               project=project,
                               marker=marker,
                               limit=limit,
                               detailed=detailed))

        # make a heap compared with 'name'
        ls = heapq.merge(*[
            utils.keyify('name', page)
            for page in all_pages()
        ])

        marker_name = {}

        # limit the iterator and strip out the comparison wrapper
        def it():
            for queue_cmp in itertools.islice(ls, limit):
                marker_name['next'] = queue_cmp.obj['name']
                yield queue_cmp.obj

        yield it()
        yield marker_name and marker_name['next']
예제 #4
0
    def _list(self,
              project=None,
              marker=None,
              limit=storage.DEFAULT_QUEUES_PER_PAGE,
              detailed=False):
        def all_pages():
            cursor = self._pool_catalog._pools_ctrl.list(limit=0)
            pools_list = list(next(cursor))
            anypool = pools_list and pools_list[0]
            if anypool:
                yield next(
                    self._pool_catalog.get_driver(
                        anypool['name']).queue_controller.list(
                            project=project,
                            marker=marker,
                            limit=limit,
                            detailed=detailed))

        # make a heap compared with 'name'
        ls = heapq.merge(*[utils.keyify('name', page) for page in all_pages()])

        marker_name = {}

        # limit the iterator and strip out the comparison wrapper
        def it():
            for queue_cmp in itertools.islice(ls, limit):
                marker_name['next'] = queue_cmp.obj['name']
                yield queue_cmp.obj

        yield it()
        yield marker_name and marker_name['next']
예제 #5
0
    def _list(self,
              project=None,
              marker=None,
              limit=storage.DEFAULT_QUEUES_PER_PAGE,
              detailed=False):
        def all_pages():
            pool = self._pool_catalog.get_default_pool()
            if pool is None:
                raise errors.NoPoolFound()
            yield next(
                pool.queue_controller.list(project=project,
                                           marker=marker,
                                           limit=limit,
                                           detailed=detailed))

        # make a heap compared with 'name'
        ls = heapq.merge(*[utils.keyify('name', page) for page in all_pages()])

        marker_name = {}

        # limit the iterator and strip out the comparison wrapper
        def it():
            for queue_cmp in itertools.islice(ls, limit):
                marker_name['next'] = queue_cmp.obj['name']
                yield queue_cmp.obj

        yield it()
        yield marker_name and marker_name['next']
예제 #6
0
파일: pooling.py 프로젝트: openstack/zaqar
    def _list(self, project=None, kfilter={}, marker=None,
              limit=storage.DEFAULT_TOPICS_PER_PAGE, detailed=False,
              name=None):

        def all_pages():
            yield next(self._mgt_topic_ctrl.list(
                project=project,
                kfilter=kfilter,
                marker=marker,
                limit=limit,
                detailed=detailed,
                name=name))

        # make a heap compared with 'name'
        ls = heapq.merge(*[
            utils.keyify('name', page)
            for page in all_pages()
        ])

        marker_name = {}

        # limit the iterator and strip out the comparison wrapper
        def it():
            for topic_cmp in itertools.islice(ls, limit):
                marker_name['next'] = topic_cmp.obj['name']
                yield topic_cmp.obj

        yield it()
        yield marker_name and marker_name['next']