summaryrefslogtreecommitdiffstats
path: root/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/GatewayConnection.java
blob: ce1edb83fa21cf34fecb239e372e9a2329d12096 (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
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.http.client.core.communication;

import com.yahoo.vespa.http.client.config.Endpoint;
import com.yahoo.vespa.http.client.core.Document;
import com.yahoo.vespa.http.client.core.ServerResponseException;
import java.io.IOException;
import java.io.InputStream;
import java.time.Instant;
import java.util.List;

public interface GatewayConnection {

    /** Returns the time this connected over the network, or null if not connected yet */
    Instant connectionTime();

    /** Returns the last time poll was called on this, or null if never */
    Instant lastPollTime();

    InputStream write(List<Document> docs) throws ServerResponseException, IOException;

    /** Returns any operation results that are ready now */
    InputStream poll() throws ServerResponseException, IOException;

    /** Attempt to drain all outstanding operations, even if this leads to blocking */
    InputStream drain() throws ServerResponseException, IOException;

    boolean connect();

    Endpoint getEndpoint();

    void handshake() throws ServerResponseException, IOException;

    void close();

}