Search in sources :

Example 6 with OperationStatus

use of com.yahoo.vespa.http.client.core.OperationStatus in project vespa by vespa-engine.

the class Feeder method flushResponseQueue.

void flushResponseQueue() throws InterruptedException {
    OperationStatus status = feedReplies.poll();
    while (status != null) {
        decreasePending(status);
        status = feedReplies.poll();
    }
}
Also used : OperationStatus(com.yahoo.vespa.http.client.core.OperationStatus)

Example 7 with OperationStatus

use of com.yahoo.vespa.http.client.core.OperationStatus in project vespa by vespa-engine.

the class Feeder method enqueue.

private void enqueue(String id, String message, ErrorCode code, boolean isConditionalNotMet, Message msg) throws InterruptedException {
    String traceMessage = msg != null && msg.getTrace() != null && msg.getTrace().getLevel() > 0 ? msg.getTrace().toString() : "";
    operations.put(new OperationStatus(message, id, code, isConditionalNotMet, traceMessage));
}
Also used : OperationStatus(com.yahoo.vespa.http.client.core.OperationStatus) Utf8String(com.yahoo.text.Utf8String)

Example 8 with OperationStatus

use of com.yahoo.vespa.http.client.core.OperationStatus in project vespa by vespa-engine.

the class FeedResponse method render.

@Override
public void render(OutputStream output) throws IOException {
    int i = 0;
    OperationStatus status;
    try {
        status = operations.take();
        while (status.errorCode != ErrorCode.END_OF_FEED) {
            output.write(toBytes(status.render()));
            if (++i % 5 == 0) {
                output.flush();
            }
            status = operations.take();
        }
    } catch (InterruptedException e) {
        output.flush();
    }
}
Also used : OperationStatus(com.yahoo.vespa.http.client.core.OperationStatus)

Example 9 with OperationStatus

use of com.yahoo.vespa.http.client.core.OperationStatus in project vespa by vespa-engine.

the class EndPointResultFactory method parseResult.

private static EndpointResult parseResult(String line, Endpoint endpoint) {
    try {
        OperationStatus reply = OperationStatus.parse(line);
        String message;
        if (EMPTY_MESSAGE.equals(reply.message)) {
            message = null;
        } else {
            message = reply.message;
        }
        Exception exception = null;
        if (!reply.errorCode.isSuccess() && message != null) {
            exception = new RuntimeException(message);
        }
        if (reply.traceMessage != null && !reply.traceMessage.isEmpty()) {
            log.fine("Got trace message: " + reply.traceMessage);
        }
        return new EndpointResult(reply.operationId, new Result.Detail(endpoint, replyToResultType(reply), reply.traceMessage, exception));
    } catch (Throwable t) {
        throw new IllegalArgumentException("Bad result line from server: '" + line + "'", t);
    }
}
Also used : EndpointResult(com.yahoo.vespa.http.client.core.EndpointResult) OperationStatus(com.yahoo.vespa.http.client.core.OperationStatus) IOException(java.io.IOException) Result(com.yahoo.vespa.http.client.Result) EndpointResult(com.yahoo.vespa.http.client.core.EndpointResult)

Example 10 with OperationStatus

use of com.yahoo.vespa.http.client.core.OperationStatus in project vespa by vespa-engine.

the class V3MockParsingRequestHandler method respondTransientFailed.

private void respondTransientFailed(PrintWriter responseWriter, String docId) {
    final OperationStatus operationStatus = new OperationStatus("Could not put", docId, ErrorCode.TRANSIENT_ERROR, false, "");
    writeResponse(responseWriter, operationStatus);
}
Also used : OperationStatus(com.yahoo.vespa.http.client.core.OperationStatus)

Aggregations

OperationStatus (com.yahoo.vespa.http.client.core.OperationStatus)15 ByteArrayInputStream (java.io.ByteArrayInputStream)2 InputStream (java.io.InputStream)2 Splitter (com.google.common.base.Splitter)1 HttpRequest (com.yahoo.container.jdisc.HttpRequest)1 HttpResponse (com.yahoo.container.jdisc.HttpResponse)1 SessionCache (com.yahoo.container.jdisc.messagebus.SessionCache)1 AccessLog (com.yahoo.container.logging.AccessLog)1 DataType (com.yahoo.document.DataType)1 DocumentType (com.yahoo.document.DocumentType)1 DocumentTypeManager (com.yahoo.document.DocumentTypeManager)1 DocumentmanagerConfig (com.yahoo.document.config.DocumentmanagerConfig)1 PutDocumentMessage (com.yahoo.documentapi.messagebus.protocol.PutDocumentMessage)1 DocumentApiMetrics (com.yahoo.documentapi.metrics.DocumentApiMetrics)1 DocumentOperationStatus (com.yahoo.documentapi.metrics.DocumentOperationStatus)1 NullFeedMetric (com.yahoo.feedhandler.NullFeedMetric)1 ReferencedResource (com.yahoo.jdisc.ReferencedResource)1 Result (com.yahoo.messagebus.Result)1 SourceSessionParams (com.yahoo.messagebus.SourceSessionParams)1 SharedSourceSession (com.yahoo.messagebus.shared.SharedSourceSession)1