@Override
  public void addCounts(UUID jobId, Map<String, Integer> newCounts) throws IOException {
    if (newCounts == null) {
      return;
    }

    Transaction transaction = datastore.newTransaction();

    for (String dataType : newCounts.keySet()) {
      Key key = getCountsKey(jobId, dataType);
      Entity current = datastore.get(key);
      Integer oldCount = 0;

      if (current != null && current.getNames().contains(COUNTS_FIELD)) {
        // Datastore only allows Long properties, but we only ever write Integers through this
        // interface so the conversion is OK
        oldCount = Math.toIntExact(current.getLong(COUNTS_FIELD));
      }
      transaction.put(
          GoogleCloudUtils.createEntityBuilder(
                  key, ImmutableMap.of(COUNTS_FIELD, oldCount + newCounts.get(dataType)))
              .build());
    }
    transaction.commit();
  }
Finds the ID of the first {@link PortabilityJob} in state {@code jobState} in Datastore, or
null if none found.

<p>TODO(rtannenbaum): Order by creation time so we can process jobs in a FIFO manner. Trying to
OrderBy.asc("created") currently fails because we don't yet have an index set up.
extensions/cloud/portability-cloud-google/src/main/java/org/datatransferproject/cloud/google/GoogleJobStore.java