Scans for stored records.

    Scans through the collection, returning stored values ordered by timestamp.

    Args:
      after_timestamp: If set, only returns values recorded after timestamp.
      include_suffix: If true, the timestamps returned are pairs of the form
        (micros_since_epoc, suffix) where suffix is a 24 bit random refinement
        to avoid collisions. Otherwise only micros_since_epoc is returned.
      max_records: The maximum number of records to return. Defaults to
        unlimited.

    Yields:
      Pairs (timestamp, rdf_value), indicating that rdf_value was stored at
      timestamp.

def Scan(self, after_timestamp=None, include_suffix=False, max_records=None):
    """Scans for stored records.

    Scans through the collection, returning stored values ordered by timestamp.

    Args:
      after_timestamp: If set, only returns values recorded after timestamp.
      include_suffix: If true, the timestamps returned are pairs of the form
        (micros_since_epoc, suffix) where suffix is a 24 bit random refinement
        to avoid collisions. Otherwise only micros_since_epoc is returned.
      max_records: The maximum number of records to return. Defaults to
        unlimited.

    Yields:
      Pairs (timestamp, rdf_value), indicating that rdf_value was stored at
      timestamp.

    """
    suffix = None
    if isinstance(after_timestamp, tuple):
      suffix = after_timestamp[1]
      after_timestamp = after_timestamp[0]

    for item, timestamp, suffix in data_store.DB.CollectionScanItems(
        self.collection_id,
        self.RDF_TYPE,
        after_timestamp=after_timestamp,
        after_suffix=suffix,
        limit=max_records):
      if include_suffix:
        yield ((timestamp, suffix), item)
      else:
        yield (timestamp, item)