Replace QueryableGraph#getBatch with #getBatchWithFieldHints. This allows alternate graph implementations to optimize how they construct node entries.
--
MOS_MIGRATED_REVID=126932020
diff --git a/src/test/java/com/google/devtools/build/skyframe/DeterministicHelper.java b/src/test/java/com/google/devtools/build/skyframe/DeterministicHelper.java
index 655333a..50bd380 100644
--- a/src/test/java/com/google/devtools/build/skyframe/DeterministicHelper.java
+++ b/src/test/java/com/google/devtools/build/skyframe/DeterministicHelper.java
@@ -17,6 +17,7 @@
import java.util.Collection;
import java.util.Comparator;
+import java.util.EnumSet;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
@@ -115,8 +116,9 @@
}
@Override
- public Map<SkyKey, NodeEntry> getBatch(Iterable<SkyKey> keys) {
- return makeDeterministic(super.getBatch(keys));
+ public Map<SkyKey, NodeEntry> getBatchWithFieldHints(
+ Iterable<SkyKey> keys, EnumSet<NodeEntryField> fields) {
+ return makeDeterministic(super.getBatchWithFieldHints(keys, fields));
}
}
diff --git a/src/test/java/com/google/devtools/build/skyframe/DeterministicInMemoryGraph.java b/src/test/java/com/google/devtools/build/skyframe/DeterministicInMemoryGraph.java
index a023383..bb61d0f 100644
--- a/src/test/java/com/google/devtools/build/skyframe/DeterministicInMemoryGraph.java
+++ b/src/test/java/com/google/devtools/build/skyframe/DeterministicInMemoryGraph.java
@@ -27,6 +27,11 @@
}
@Override
+ public Map<SkyKey, NodeEntry> getBatch(Iterable<SkyKey> keys) {
+ return getBatchWithFieldHints(keys, NodeEntryField.ALL_FIELDS);
+ }
+
+ @Override
public Map<SkyKey, SkyValue> getValues() {
return ((InMemoryGraph) delegate).getValues();
}
diff --git a/src/test/java/com/google/devtools/build/skyframe/GraphConcurrencyTest.java b/src/test/java/com/google/devtools/build/skyframe/GraphConcurrencyTest.java
index a0580e2..73e42ea 100644
--- a/src/test/java/com/google/devtools/build/skyframe/GraphConcurrencyTest.java
+++ b/src/test/java/com/google/devtools/build/skyframe/GraphConcurrencyTest.java
@@ -275,8 +275,9 @@
}
/**
- * Initially calling {@link NodeEntry#setValue} and then making sure concurrent calls to
- * {@link QueryableGraph#get} and {@link QueryableGraph#getBatch} do not interfere with the node.
+ * Initially calling {@link NodeEntry#setValue} and then making sure concurrent calls to {@link
+ * QueryableGraph#get} and {@link QueryableGraph#getBatchWithFieldHints} do not interfere with the
+ * node.
*/
@Test
public void testDoneToDirty() throws Exception {
@@ -377,15 +378,16 @@
} catch (InterruptedException e) {
throw new AssertionError(e);
}
- Map<SkyKey, NodeEntry> batchMap = graph.getBatch(batch);
+ Map<SkyKey, NodeEntry> batchMap =
+ graph.getBatchWithFieldHints(batch, NodeEntryField.NO_FIELDS);
getBatchCountDownLatch.countDown();
assertThat(batchMap).hasSize(batch.size());
for (NodeEntry entry : batchMap.values()) {
// Batch requests are made at the same time that the version increments from the
// base. Check that there is no problem in requesting the version and that the
// number is sane.
- assertThat(entry.getVersion()).isAnyOf(startingVersion,
- getNextVersion(startingVersion));
+ assertThat(entry.getVersion())
+ .isAnyOf(startingVersion, getNextVersion(startingVersion));
}
}
};
diff --git a/src/test/java/com/google/devtools/build/skyframe/NotifyingHelper.java b/src/test/java/com/google/devtools/build/skyframe/NotifyingHelper.java
index 2f973b5..711e9e7 100644
--- a/src/test/java/com/google/devtools/build/skyframe/NotifyingHelper.java
+++ b/src/test/java/com/google/devtools/build/skyframe/NotifyingHelper.java
@@ -20,6 +20,7 @@
import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe;
import com.google.devtools.build.lib.util.GroupedList;
+import java.util.EnumSet;
import java.util.Map;
import java.util.Set;
@@ -121,8 +122,10 @@
}
@Override
- public Map<SkyKey, NodeEntry> getBatch(Iterable<SkyKey> keys) {
- return Maps.transformEntries(delegate.getBatch(keys), notifyingHelper.wrapEntry);
+ public Map<SkyKey, NodeEntry> getBatchWithFieldHints(
+ Iterable<SkyKey> keys, EnumSet<NodeEntryField> fields) {
+ return Maps.transformEntries(
+ delegate.getBatchWithFieldHints(keys, fields), notifyingHelper.wrapEntry);
}
@Nullable
diff --git a/src/test/java/com/google/devtools/build/skyframe/NotifyingInMemoryGraph.java b/src/test/java/com/google/devtools/build/skyframe/NotifyingInMemoryGraph.java
index 752dac7..1689440 100644
--- a/src/test/java/com/google/devtools/build/skyframe/NotifyingInMemoryGraph.java
+++ b/src/test/java/com/google/devtools/build/skyframe/NotifyingInMemoryGraph.java
@@ -23,6 +23,11 @@
}
@Override
+ public Map<SkyKey, NodeEntry> getBatch(Iterable<SkyKey> keys) {
+ return getBatchWithFieldHints(keys, NodeEntryField.ALL_FIELDS);
+ }
+
+ @Override
public Map<SkyKey, SkyValue> getValues() {
return ((InMemoryGraph) delegate).getValues();
}