// shouldn't happen
throw new IllegalStateException("sequence name is null");
}
DatastoreServiceConfig config = ((DatastoreManager) storeMgr).getDefaultDatastoreServiceConfigForWrites();
DatastoreService ds = DatastoreServiceFactoryInternal.getDatastoreService(config);
KeyRange range = ds.allocateIds(sequenceName, size);
// Too bad we can't pass an iterable and construct the ids
// on demand.
List<Long> ids = Utils.newArrayList();
long current = range.getStart().getId();
for (int i = 0; i < size; i++) {
ids.add(current + i);
}
return new ValueGenerationBlock(ids);
}