blob: e3b6b594593cbab22dbfa769c5e669ca543e01c0 (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.feed.client.impl;
import ai.vespa.feed.client.DocumentId;
import ai.vespa.feed.client.FeedClient.CircuitBreaker.State;
import ai.vespa.feed.client.HttpResponse;
import ai.vespa.feed.client.OperationStats;
import java.util.concurrent.CompletableFuture;
/**
* Controls execution of feed operations.
*
* @author jonmv
*/
interface RequestStrategy {
/** Stats for operations sent through this. */
OperationStats stats();
/** State of the circuit breaker. */
State circuitBreakerState();
/** Forcibly terminates this, causing all inflight operations to complete immediately. */
void destroy();
/** Wait for all inflight requests to complete. */
void await();
/** Enqueue the given operation, returning its future result. This may block if the client send queue is full. */
CompletableFuture<HttpResponse> enqueue(DocumentId documentId, HttpRequest request);
}
|