code: func finishedInvQuery(c context.Context, job *Job, lastScanned int64) *invDatastoreQuery {
  	q := datastore.NewQuery("Invocation")
  	q = q.Eq("IndexedJobID", job.JobID)
  	if lastScanned > 0 {
  		q = q.Gt("__key__", datastore.KeyForObj(c, &Invocation{ID: lastScanned}))
  	}
  	q = q.Order("__key__")
  	out := &invDatastoreQuery{}
  	out.iter.start(c, q)
  	return out
  }
docs: // finishedInvQuery returns invQuery that emits historical finished invocations,
  // of the given job.
  //
  // Smallest IDs are returned first. IDs smaller than or equal to lastScanned are
  // skipped (this is used for pagination).