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']
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']
def list(self, project): fields = {'_id': 0} query = utils.scoped_query(None, project) return utils.HookedCursor(self._col.find(query, fields), _normalize)