'Return an iterable of models.Resource instances
Items are constrained by sample timestamp.
:param query: project/user/source query
:param start_timestamp: modified timestamp start range.
:param start_timestamp_op: start time operator, like gt, ge.
:param end_timestamp: modified timestamp end range.
:param end_timestamp_op: end time operator, like lt, le.
:param metaquery: dict with metadata to match on.
:param resource: resource filter.'

def _get_time_constrained_resources(self, query, start_timestamp, start_timestamp_op, end_timestamp, end_timestamp_op, metaquery, resource, limit):

    if (resource is not None):
        query['resource_id'] = resource
    query.update(dict(((('resource_' + k), v) for (k, v) in six.iteritems(metaquery))))
    ts_range = pymongo_utils.make_timestamp_range(start_timestamp, end_timestamp, start_timestamp_op, end_timestamp_op)
    if ts_range:
        query['timestamp'] = ts_range
    sort_keys = base._handle_sort_key('resource')
    sort_instructions = self._build_sort_instructions(sort_keys)[0]
    out = ('resource_list_%s' % uuid.uuid4())
    self.db.meter.map_reduce(self.MAP_RESOURCES, self.REDUCE_RESOURCES, out=out, sort={'resource_id': 1}, query=query)
    try:
        if (limit is not None):
            results = self.db[out].find(sort=sort_instructions, limit=limit)
        else:
            results = self.db[out].find(sort=sort_instructions)
        for r in results:
            resource = r['value']
            (yield models.Resource(resource_id=r['_id'], user_id=resource['user_id'], project_id=resource['project_id'], first_sample_timestamp=resource['first_timestamp'], last_sample_timestamp=resource['last_timestamp'], source=resource['source'], metadata=pymongo_utils.unquote_keys(resource['metadata'])))
    finally:
        self.db[out].drop()
