From c55fe15fc36ad01b93f4efe85ff85911d041d5d7 Mon Sep 17 00:00:00 2001 From: Nathan Harmata Date: Tue, 2 Aug 2016 18:13:28 +0000 Subject: Delete NodeEntryField since it's now superfluous in the presence of the new QueryableGraph.Reason which conveys more information. Add a few more Reason enum values to make this refactor benign. -- MOS_MIGRATED_REVID=129118462 --- .../build/skyframe/DelegatingWalkableGraph.java | 24 ++++++++-------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'src/main/java/com/google/devtools/build/skyframe/DelegatingWalkableGraph.java') diff --git a/src/main/java/com/google/devtools/build/skyframe/DelegatingWalkableGraph.java b/src/main/java/com/google/devtools/build/skyframe/DelegatingWalkableGraph.java index b6c582559e..c56bf55132 100644 --- a/src/main/java/com/google/devtools/build/skyframe/DelegatingWalkableGraph.java +++ b/src/main/java/com/google/devtools/build/skyframe/DelegatingWalkableGraph.java @@ -19,7 +19,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Maps; import com.google.devtools.build.lib.util.Preconditions; import com.google.devtools.build.skyframe.QueryableGraph.Reason; -import java.util.EnumSet; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; @@ -36,11 +35,10 @@ public class DelegatingWalkableGraph implements WalkableGraph { this.graph = graph; } - private NodeEntry getEntry(SkyKey key) { + private NodeEntry getEntryForValue(SkyKey key) { NodeEntry entry = Preconditions.checkNotNull( - graph.getBatchWithFieldHints( - null, Reason.OTHER, ImmutableList.of(key), NodeEntryField.VALUE_ONLY).get(key), + graph.getBatch(null, Reason.WALKABLE_GRAPH_VALUE, ImmutableList.of(key)).get(key), key); Preconditions.checkState(entry.isDone(), "%s %s", key, entry); return entry; @@ -49,15 +47,14 @@ public class DelegatingWalkableGraph implements WalkableGraph { @Override public boolean exists(SkyKey key) { NodeEntry entry = - graph.getBatchWithFieldHints( - null, Reason.OTHER, ImmutableList.of(key), NodeEntryField.NO_FIELDS).get(key); + graph.getBatch(null, Reason.EXISTENCE_CHECKING, ImmutableList.of(key)).get(key); return entry != null && entry.isDone(); } @Nullable @Override public SkyValue getValue(SkyKey key) { - return getEntry(key).getValue(); + return getEntryForValue(key).getValue(); } private static final Function GET_SKY_VALUE_FUNCTION = @@ -73,7 +70,7 @@ public class DelegatingWalkableGraph implements WalkableGraph { public Map getSuccessfulValues(Iterable keys) { return Maps.filterValues( Maps.transformValues( - graph.getBatchWithFieldHints(null, Reason.OTHER, keys, NodeEntryField.VALUE_ONLY), + graph.getBatch(null, Reason.WALKABLE_GRAPH_VALUE, keys), GET_SKY_VALUE_FUNCTION), Predicates.notNull()); } @@ -81,8 +78,7 @@ public class DelegatingWalkableGraph implements WalkableGraph { @Override public Map getMissingAndExceptions(Iterable keys) { Map result = new HashMap<>(); - Map graphResult = - graph.getBatchWithFieldHints(null, Reason.OTHER, keys, NodeEntryField.VALUE_ONLY); + Map graphResult = graph.getBatch(null, Reason.WALKABLE_GRAPH_VALUE, keys); for (SkyKey key : keys) { NodeEntry nodeEntry = graphResult.get(key); if (nodeEntry == null || !nodeEntry.isDone()) { @@ -100,14 +96,13 @@ public class DelegatingWalkableGraph implements WalkableGraph { @Nullable @Override public Exception getException(SkyKey key) { - ErrorInfo errorInfo = getEntry(key).getErrorInfo(); + ErrorInfo errorInfo = getEntryForValue(key).getErrorInfo(); return errorInfo == null ? null : errorInfo.getException(); } @Override public Map> getDirectDeps(Iterable keys) { - Map entries = graph.getBatchWithFieldHints( - null, Reason.OTHER, keys, EnumSet.of(NodeEntryField.DIRECT_DEPS)); + Map entries = graph.getBatch(null, Reason.WALKABLE_GRAPH_DEPS, keys); Map> result = new HashMap<>(entries.size()); for (Entry entry : entries.entrySet()) { Preconditions.checkState(entry.getValue().isDone(), entry); @@ -118,8 +113,7 @@ public class DelegatingWalkableGraph implements WalkableGraph { @Override public Map> getReverseDeps(Iterable keys) { - Map entries = graph.getBatchWithFieldHints( - null, Reason.OTHER, keys, EnumSet.of(NodeEntryField.REVERSE_DEPS)); + Map entries = graph.getBatch(null, Reason.WALKABLE_GRAPH_RDEPS, keys); Map> result = new HashMap<>(entries.size()); for (Entry entry : entries.entrySet()) { Preconditions.checkState(entry.getValue().isDone(), entry); -- cgit v1.2.3