use of org.apache.bookkeeper.stream.proto.storage.StatusCode in project bookkeeper by apache.
the class RootRangeClientImpl method processCreateNamespaceResponse.
private void processCreateNamespaceResponse(String namespace, CreateNamespaceResponse response, CompletableFuture<NamespaceProperties> createNamespaceFuture) {
StatusCode code = response.getCode();
if (StatusCode.SUCCESS == code) {
createNamespaceFuture.complete(response.getColProps());
return;
}
createNamespaceFuture.completeExceptionally(createRootRangeException(namespace, code));
}
use of org.apache.bookkeeper.stream.proto.storage.StatusCode in project bookkeeper by apache.
the class RootRangeClientImpl method processGetNamespaceResponse.
private void processGetNamespaceResponse(String namespace, GetNamespaceResponse response, CompletableFuture<NamespaceProperties> getFuture) {
StatusCode code = response.getCode();
if (StatusCode.SUCCESS == code) {
getFuture.complete(response.getColProps());
return;
}
getFuture.completeExceptionally(createRootRangeException(namespace, code));
}
use of org.apache.bookkeeper.stream.proto.storage.StatusCode in project bookkeeper by apache.
the class RootRangeClientImpl method processCreateStreamResponse.
private void processCreateStreamResponse(String streamName, CreateStreamResponse response, CompletableFuture<StreamProperties> createStreamFuture) {
StatusCode code = response.getCode();
if (StatusCode.SUCCESS == code) {
createStreamFuture.complete(response.getStreamProps());
return;
}
createStreamFuture.completeExceptionally(createRootRangeException(streamName, code));
}
use of org.apache.bookkeeper.stream.proto.storage.StatusCode in project bookkeeper by apache.
the class TableStoreUtilsTest method testHandleCause.
@Test
public void testHandleCause() {
StatusCode[] protoCodes = new StatusCode[] { StatusCode.SUCCESS, StatusCode.INTERNAL_SERVER_ERROR, StatusCode.BAD_REQUEST, StatusCode.BAD_REQUEST, StatusCode.UNEXPECTED, StatusCode.BAD_REVISION, StatusCode.BAD_REVISION, StatusCode.KEY_NOT_FOUND, StatusCode.KEY_EXISTS };
Code[] codes = new Code[] { Code.OK, Code.INTERNAL_ERROR, Code.INVALID_ARGUMENT, Code.ILLEGAL_OP, Code.UNEXPECTED, Code.BAD_REVISION, Code.SMALLER_REVISION, Code.KEY_NOT_FOUND, Code.KEY_EXISTS };
for (int i = 0; i < codes.length; i++) {
Code code = codes[i];
MVCCStoreException exception = new MVCCStoreException(code, "test-" + code);
assertEquals(protoCodes[i], handleCause(exception));
}
}
use of org.apache.bookkeeper.stream.proto.storage.StatusCode in project bookkeeper by apache.
the class RootRangeStoreImpl method verifyDeleteNamespaceRequest.
StatusCode verifyDeleteNamespaceRequest(DeleteNamespaceRequest request) {
String colName = request.getName();
StatusCode code = StatusCode.SUCCESS;
if (!validateNamespaceName(colName)) {
log.error("Failed to delete namespace due to invalid namespace name {}", colName);
code = StatusCode.INVALID_NAMESPACE_NAME;
}
return code;
}
Aggregations