'Get a list of objects sorted by name starting at marker onward, up
to limit entries.  Entries will begin with the prefix and will not
have the delimiter after the prefix.
:param limit: maximum number of entries to get
:param marker: marker query
:param end_marker: end marker query
:param prefix: prefix query
:param delimiter: delimiter for query
:param path: if defined, will set the prefix and delimiter based on
the path
:param storage_policy_index: storage policy index for query
:param reverse: reverse the result order.
:returns: list of tuples of (name, created_at, size, content_type,
etag)'

def list_objects_iter(self, limit, marker, end_marker, prefix, delimiter, path=None, storage_policy_index=0, reverse=False):

    delim_force_gte = False
    (marker, end_marker, prefix, delimiter, path) = utf8encode(marker, end_marker, prefix, delimiter, path)
    self._commit_puts_stale_ok()
    if reverse:
        (marker, end_marker) = (end_marker, marker)
    if (path is not None):
        prefix = path
        if path:
            prefix = path = (path.rstrip('/') + '/')
        delimiter = '/'
    elif (delimiter and (not prefix)):
        prefix = ''
    if prefix:
        end_prefix = (prefix[:(-1)] + chr((ord(prefix[(-1)]) + 1)))
    orig_marker = marker
    with self.get() as conn:
        results = []
        while (len(results) < limit):
            query = 'SELECT    name,    created_at,    size,    content_type,    etag\n                                                                                                            FROM    object    WHERE'
            query_args = []
            if (end_marker and ((not prefix) or (end_marker < end_prefix))):
                query += '    name    <    ?    AND'
                query_args.append(end_marker)
            elif prefix:
                query += '    name    <    ?    AND'
                query_args.append(end_prefix)
            if delim_force_gte:
                query += '    name    >=    ?    AND'
                query_args.append(marker)
                delim_force_gte = False
            elif (marker and (marker >= prefix)):
                query += '    name    >    ?    AND'
                query_args.append(marker)
            elif prefix:
                query += '    name    >=    ?    AND'
                query_args.append(prefix)
            if (self.get_db_version(conn) < 1):
                query += '    +deleted    =    0'
            else:
                query += '    deleted    =    0'
            orig_tail_query = ('\n                                                                                ORDER    BY    name    %s    LIMIT    ?\n                                                                ' % ('DESC' if reverse else ''))
            orig_tail_args = [(limit - len(results))]
            policy_tail_query = ('\n                                                                                AND    storage_policy_index    =    ?\n                                                                ' + orig_tail_query)
            policy_tail_args = ([storage_policy_index] + orig_tail_args)
            (tail_query, tail_args) = (policy_tail_query, policy_tail_args)
            try:
                curs = conn.execute((query + tail_query), tuple((query_args + tail_args)))
            except sqlite3.OperationalError as err:
                if ('no    such    column:    storage_policy_index' not in str(err)):
                    raise
                (tail_query, tail_args) = (orig_tail_query, orig_tail_args)
                curs = conn.execute((query + tail_query), tuple((query_args + tail_args)))
            curs.row_factory = None
            if ((prefix is None) or (not delimiter)):
                return [self._transform_record(r) for r in curs]
            rowcount = 0
            for row in curs:
                rowcount += 1
                name = row[0]
                if reverse:
                    end_marker = name
                else:
                    marker = name
                if (len(results) >= limit):
                    curs.close()
                    return results
                end = name.find(delimiter, len(prefix))
                if (path is not None):
                    if (name == path):
                        continue
                    if ((end >= 0) and (len(name) > (end + len(delimiter)))):
                        if reverse:
                            end_marker = name[:(end + 1)]
                        else:
                            marker = (name[:end] + chr((ord(delimiter) + 1)))
                        curs.close()
                        break
                elif (end >= 0):
                    if reverse:
                        end_marker = name[:(end + 1)]
                    else:
                        marker = (name[:end] + chr((ord(delimiter) + 1)))
                        delim_force_gte = True
                    dir_name = name[:(end + 1)]
                    if (dir_name != orig_marker):
                        results.append([dir_name, '0', 0, None, ''])
                    curs.close()
                    break
                results.append(self._transform_record(row))
            if (not rowcount):
                break
        return results
