aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/query2/engine
diff options
context:
space:
mode:
authorGravatar Janak Ramakrishnan <janakr@google.com>2016-01-08 16:24:29 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-01-11 09:39:16 +0000
commitae3a20a1e43f01c1bc1441824fcfd086c89d18e6 (patch)
tree5e9bbbfa818310ddb5e0bde052f5b44d3fef8ab9 /src/main/java/com/google/devtools/build/lib/query2/engine
parent930bf691af499e39c00f473a7281f864c67c111b (diff)
Stream result of TargetPattern#eval to a callback instead of returning it directly, and pass a Query callback in when resolving target patterns. This means that the targets a pattern resolves to can be processed incrementally.
This is the fifth step in a series to allow processing large sets of targets in query target patterns via streaming batches rather than all at once. This should improve performance for SkyQueryEnvironment for certain classes of large queries. -- MOS_MIGRATED_REVID=111696713
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/query2/engine')
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/Callback.java17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/Callback.java b/src/main/java/com/google/devtools/build/lib/query2/engine/Callback.java
index 925fe57aeb..bee90ad0e3 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/Callback.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/Callback.java
@@ -13,24 +13,19 @@
// limitations under the License.
package com.google.devtools.build.lib.query2.engine;
+import com.google.devtools.build.lib.util.BatchCallback;
+
/**
* Query callback to be called by a {@link QueryExpression} when it has part of the computation
* result. Assuming the {@code QueryEnvironment} supports it, it would allow the caller
* to stream the results.
*/
-// TODO(janakr): have this inherit from com.google.devtools.build.lib.util.BatchCallback.
-public interface Callback<T> {
+public interface Callback<T> extends BatchCallback<T, QueryException> {
/**
- * Called by {@code QueryExpression} when it has been able to compute part of the result.
- *
- * <p>Note that this method can be called several times for a QueryExpression. Callers
- * implementing this method should assume that multiple calls can happen.
- *
- * @param partialResult Part of the result. Note that from the caller's perspective, it is
- * guaranteed that no repeated elements will be returned. However {@code QueryExpression}s calling
- * the callback do not need to maintain this property, as the {@code QueryEnvironment} should
- * handle the uniqueness.
+ * According to the {@link BatchCallback} interface, repeated elements may be passed in here.
+ * However, {@code QueryExpression}s calling the callback do not need to maintain this property,
+ * as the {@code QueryEnvironment} should filter out duplicates.
*/
void process(Iterable<T> partialResult) throws QueryException, InterruptedException;
}