aboutsummaryrefslogtreecommitdiffstats
path: root/documentapi/src/main/java/com/yahoo/documentapi/VisitorSession.java
blob: e2efaf1de10d56a5bbaccc2ca6ed0aee401e33dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.documentapi;

import com.yahoo.messagebus.Trace;

/**
 * A session for tracking progress for and potentially receiving data from a visitor.
 *
 * @author Thomas Gundersen
 */
public interface VisitorSession extends VisitorControlSession {
    /**
     * Checks if visiting is done.
     *
     * @return True if visiting is done (either by error or success).
     */
    boolean isDone();

    /**
     * Retrieves the last progress token gotten for this visitor.
     *
     * @return The progress token.
     */
    ProgressToken getProgress();

    /**
     * Returns the tracing information so far about the visitor.
     *
     * @return Returns the trace.
     */
    Trace getTrace();

    /**
     * Waits until visiting is done, or the given timeout (in ms) expires.
     * Will wait forever if timeout is 0.
     *
     * @param timeoutMs The maximum amount of milliseconds to wait.
     * @return True if visiting is done (either by error or success).
     * @throws InterruptedException If an interrupt signal was received while waiting.
     */
    boolean waitUntilDone(long timeoutMs) throws InterruptedException;
}