diff options
author | 2018-05-18 11:45:44 -0700 | |
---|---|---|
committer | 2018-05-18 11:47:40 -0700 | |
commit | 19b4377b3f99222dea874376aa5fc342b43f42bf (patch) | |
tree | ed7f4de7a7f1e22941bc10817ac55d8ef915116e /src/main/java/com/google/devtools/build/lib/query2/AbstractSkyKeyParallelVisitor.java | |
parent | b82db7801f9e21ec0488ba0cd211b6a03460de0e (diff) |
Move various visitor classes into their own classes. ParallelSkyQueryUtils is currently quite large and hard to navigate. Also, rename AbstractRdepsVisitor to AbstractEdgeVisitor as there is nothing specific about rdeps involved.
PiperOrigin-RevId: 197177966
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/query2/AbstractSkyKeyParallelVisitor.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/query2/AbstractSkyKeyParallelVisitor.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/query2/AbstractSkyKeyParallelVisitor.java b/src/main/java/com/google/devtools/build/lib/query2/AbstractSkyKeyParallelVisitor.java new file mode 100644 index 0000000000..972e6703c6 --- /dev/null +++ b/src/main/java/com/google/devtools/build/lib/query2/AbstractSkyKeyParallelVisitor.java @@ -0,0 +1,38 @@ +// Copyright 2016 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.google.devtools.build.lib.query2; + +import com.google.common.collect.ImmutableList; +import com.google.devtools.build.lib.query2.engine.Callback; +import com.google.devtools.build.lib.query2.engine.Uniquifier; +import com.google.devtools.build.skyframe.SkyKey; + +/** A {@link ParallelVisitor} whose visitations occur on {@link SkyKey}s. */ +public abstract class AbstractSkyKeyParallelVisitor<T> extends ParallelVisitor<SkyKey, T> { + private final Uniquifier<SkyKey> uniquifier; + + protected AbstractSkyKeyParallelVisitor( + Uniquifier<SkyKey> uniquifier, + Callback<T> callback, + int visitBatchSize, + int processResultsBatchSize) { + super(callback, visitBatchSize, processResultsBatchSize); + this.uniquifier = uniquifier; + } + + @Override + protected ImmutableList<SkyKey> getUniqueValues(Iterable<SkyKey> values) { + return uniquifier.unique(values); + } +} |