diff options
Diffstat (limited to 'src/test/java/com/google/devtools/build/skyframe')
4 files changed, 31 insertions, 46 deletions
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 e27cab4790..f2a1560f54 100644 --- a/src/test/java/com/google/devtools/build/skyframe/DeterministicHelper.java +++ b/src/test/java/com/google/devtools/build/skyframe/DeterministicHelper.java @@ -41,8 +41,8 @@ public class DeterministicHelper extends NotifyingHelper { } @Override - public InvalidatableGraph transform(InvalidatableGraph graph) { - return new DeterministicInvalidatableGraph(graph, listener); + public QueryableGraph transform(QueryableGraph graph) { + return new DeterministicQueryableGraph(graph, listener); } @Override @@ -83,14 +83,17 @@ public class DeterministicHelper extends NotifyingHelper { return result; } - private static class DeterministicInvalidatableGraph extends NotifyingInvalidatableGraph { - DeterministicInvalidatableGraph(InvalidatableGraph delegate, Listener graphListener) { + private static class DeterministicQueryableGraph extends NotifyingQueryableGraph { + DeterministicQueryableGraph(QueryableGraph delegate, Listener graphListener) { super(delegate, new DeterministicHelper(graphListener)); } @Override - public Map<SkyKey, NodeEntry> getBatchForInvalidation(Iterable<SkyKey> keys) { - return makeDeterministic(super.getBatchForInvalidation(keys)); + public Map<SkyKey, NodeEntry> getBatch( + @Nullable SkyKey requestor, + Reason reason, + Iterable<SkyKey> keys) { + return makeDeterministic(super.getBatch(requestor, reason, keys)); } } 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 fda230ead1..a0233838ec 100644 --- a/src/test/java/com/google/devtools/build/skyframe/DeterministicInMemoryGraph.java +++ b/src/test/java/com/google/devtools/build/skyframe/DeterministicInMemoryGraph.java @@ -27,11 +27,6 @@ class DeterministicInMemoryGraph extends DeterministicHelper.DeterministicProces } @Override - public Map<SkyKey, NodeEntry> getBatchForInvalidation(Iterable<SkyKey> keys) { - return getBatch(null, Reason.INVALIDATION, keys); - } - - @Override public Map<SkyKey, SkyValue> getValues() { return ((InMemoryGraph) delegate).getValues(); } 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 655b7f8276..ad9a591eb8 100644 --- a/src/test/java/com/google/devtools/build/skyframe/NotifyingHelper.java +++ b/src/test/java/com/google/devtools/build/skyframe/NotifyingHelper.java @@ -40,8 +40,8 @@ public class NotifyingHelper { } @Override - public InvalidatableGraph transform(InvalidatableGraph graph) { - return new NotifyingInvalidatableGraph(graph, listener); + public QueryableGraph transform(QueryableGraph graph) { + return new NotifyingQueryableGraph(graph, listener); } @Override @@ -72,39 +72,47 @@ public class NotifyingHelper { return entry == null ? null : new NotifyingNodeEntry(key, entry); } - static class NotifyingInvalidatableGraph implements InvalidatableGraph { - private final InvalidatableGraph delegate; - private final NotifyingHelper notifyingHelper; + static class NotifyingQueryableGraph implements QueryableGraph { + private final QueryableGraph delegate; + protected final NotifyingHelper notifyingHelper; - NotifyingInvalidatableGraph(InvalidatableGraph delegate, Listener graphListener) { + NotifyingQueryableGraph(QueryableGraph delegate, Listener graphListener) { this.notifyingHelper = new NotifyingHelper(graphListener); this.delegate = delegate; } - NotifyingInvalidatableGraph(InvalidatableGraph delegate, NotifyingHelper helper) { + NotifyingQueryableGraph(QueryableGraph delegate, NotifyingHelper helper) { this.notifyingHelper = helper; this.delegate = delegate; } @Override - public Map<SkyKey, NodeEntry> getBatchForInvalidation(Iterable<SkyKey> keys) { + public Map<SkyKey, NodeEntry> getBatch( + @Nullable SkyKey requestor, + Reason reason, + Iterable<SkyKey> keys) { return Maps.transformEntries( - delegate.getBatchForInvalidation(keys), + delegate.getBatch(requestor, reason, keys), notifyingHelper.wrapEntry); } + + @Nullable + @Override + public NodeEntry get(@Nullable SkyKey requestor, Reason reason, SkyKey key) { + return notifyingHelper.wrapEntry(key, delegate.get(requestor, reason, key)); + } } - static class NotifyingProcessableGraph implements ProcessableGraph { + static class NotifyingProcessableGraph + extends NotifyingQueryableGraph implements ProcessableGraph { protected final ProcessableGraph delegate; - protected final NotifyingHelper notifyingHelper; NotifyingProcessableGraph(ProcessableGraph delegate, Listener graphListener) { - this.notifyingHelper = new NotifyingHelper(graphListener); - this.delegate = delegate; + this(delegate, new NotifyingHelper(graphListener)); } NotifyingProcessableGraph(ProcessableGraph delegate, NotifyingHelper helper) { - this.notifyingHelper = helper; + super(delegate, helper); this.delegate = delegate; } @@ -123,22 +131,6 @@ public class NotifyingHelper { delegate.createIfAbsentBatch(requestor, reason, keys), notifyingHelper.wrapEntry); } - - @Override - public Map<SkyKey, NodeEntry> getBatch( - @Nullable SkyKey requestor, - Reason reason, - Iterable<SkyKey> keys) { - return Maps.transformEntries( - delegate.getBatch(requestor, reason, keys), - notifyingHelper.wrapEntry); - } - - @Nullable - @Override - public NodeEntry get(@Nullable SkyKey requestor, Reason reason, SkyKey key) { - return notifyingHelper.wrapEntry(key, delegate.get(requestor, reason, key)); - } } /** 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 1aa32cebdb..752dac7001 100644 --- a/src/test/java/com/google/devtools/build/skyframe/NotifyingInMemoryGraph.java +++ b/src/test/java/com/google/devtools/build/skyframe/NotifyingInMemoryGraph.java @@ -23,11 +23,6 @@ class NotifyingInMemoryGraph extends NotifyingHelper.NotifyingProcessableGraph } @Override - public Map<SkyKey, NodeEntry> getBatchForInvalidation(Iterable<SkyKey> keys) { - return getBatch(null, Reason.INVALIDATION, keys); - } - - @Override public Map<SkyKey, SkyValue> getValues() { return ((InMemoryGraph) delegate).getValues(); } |