com.yahoo.documentapi.metrics.DocumentOperationStatus Maven / Gradle / Ivy
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.documentapi.metrics;
import com.yahoo.documentapi.messagebus.protocol.DocumentProtocol;
import java.util.Set;
/**
* Enum with possible outcomes of a single document feeding operation:
*
* - OK: Document was successfully added/updated/removed
* - REQUEST_ERROR: User-made error, for example invalid document format
* - SERVER_ERROR: Server-made error, for example insufficient disk space
*
*
* @author freva
*/
public enum DocumentOperationStatus {
OK, REQUEST_ERROR, SERVER_ERROR, CONDITION_FAILED, NOT_FOUND, TOO_MANY_REQUESTS;
public static DocumentOperationStatus fromMessageBusErrorCodes(Set errorCodes) {
if (errorCodes.size() == 1 && errorCodes.contains(DocumentProtocol.ERROR_NO_SPACE))
return SERVER_ERROR;
return REQUEST_ERROR;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy