tmf: Add a method to verify if analysis is ready at timestamp
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Fri, 1 Apr 2016 20:29:00 +0000 (16:29 -0400)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Tue, 26 Apr 2016 13:55:18 +0000 (09:55 -0400)
First step to resolve bug 488757. This new method will return whether an
analysis is ready to be queried at a given timestamp.

Change-Id: I2a1f597d503fe74664df95d0bb5c4c16952b6376
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/69753
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/analysis/IAnalysisModule.java

index 0a8061b54d34d502e455721d09fb4ece73624cbf..0c6a34f79f11cb4e14865c74777b650190d65b9c 100644 (file)
@@ -99,8 +99,8 @@ public interface IAnalysisModule extends ITmfComponent, IAnalysisRequirementProv
      * @param trace
      *            The trace to run the analysis on
      * @return {@code true} if the trace was successfully set on the module,
-     *         {@code false} if the analysis cannot be applied to the trace,
-     *         for instance if the trace does not have the right requirements
+     *         {@code false} if the analysis cannot be applied to the trace, for
+     *         instance if the trace does not have the right requirements
      * @throws TmfAnalysisException
      *             This exception should be thrown if the trace is set more than
      *             once
@@ -203,6 +203,30 @@ public interface IAnalysisModule extends ITmfComponent, IAnalysisRequirementProv
      */
     boolean waitForCompletion(@NonNull IProgressMonitor monitor);
 
+    /**
+     * Return whether the analysis is ready to be queried at a given time.
+     *
+     * A return value of <code>false</code> means that the caller can wait and
+     * this will eventually return <code>true</code>.
+     *
+     * Note to implementers: If the analysis is not started or completed, even
+     * though the timestamp was not part of it, or cancelled, this should return
+     * <code>true</code> so the caller does not end up waiting for something
+     * that will never happen. Calling this method can however trigger the
+     * scheduling of the analysis. In this case, it may return
+     * <code>false</code> until the timestamp is covered.
+     *
+     * @param ts
+     *            The timestamp to validate
+     * @return Whether the analysis is ready to be queried at the timestamp. A
+     *         value of <code>false</code> means the caller may wait until the
+     *         analysis has reached the desired time.
+     * @since 2.0
+     */
+    default boolean isQueryable(long ts) {
+        return true;
+    }
+
     /**
      * Cancels the current analysis
      */
This page took 0.026133 seconds and 5 git commands to generate.