Search in sources :

Example 11 with StatusCode

use of org.apache.bookkeeper.stream.proto.storage.StatusCode in project bookkeeper by apache.

the class RootRangeClientImpl method processDeleteStreamResponse.

private void processDeleteStreamResponse(String streamName, DeleteStreamResponse response, CompletableFuture<Boolean> deleteStreamFuture) {
    StatusCode code = response.getCode();
    if (StatusCode.SUCCESS == code) {
        deleteStreamFuture.complete(true);
        return;
    }
    deleteStreamFuture.completeExceptionally(createRootRangeException(streamName, code));
}
Also used : StatusCode(org.apache.bookkeeper.stream.proto.storage.StatusCode)

Example 12 with StatusCode

use of org.apache.bookkeeper.stream.proto.storage.StatusCode in project bookkeeper by apache.

the class RootRangeStoreImpl method deleteStream.

@Override
public CompletableFuture<DeleteStreamResponse> deleteStream(DeleteStreamRequest request) {
    String streamName = request.getName();
    String nsName = request.getColName();
    StatusCode code = verifyStreamRequest(nsName, streamName);
    if (StatusCode.SUCCESS != code) {
        return FutureUtils.value(DeleteStreamResponse.newBuilder().setCode(code).build());
    }
    return deleteStream(nsName, streamName);
}
Also used : StatusCode(org.apache.bookkeeper.stream.proto.storage.StatusCode)

Example 13 with StatusCode

use of org.apache.bookkeeper.stream.proto.storage.StatusCode in project bookkeeper by apache.

the class RootRangeStoreImpl method verifyCreateNamespaceRequest.

StatusCode verifyCreateNamespaceRequest(CreateNamespaceRequest request) {
    String colName = request.getName();
    StatusCode code = StatusCode.SUCCESS;
    if (!validateNamespaceName(colName)) {
        log.error("Failed to create namespace due to invalid namespace name {}", colName);
        code = StatusCode.INVALID_NAMESPACE_NAME;
    }
    return code;
}
Also used : StatusCode(org.apache.bookkeeper.stream.proto.storage.StatusCode)

Aggregations

StatusCode (org.apache.bookkeeper.stream.proto.storage.StatusCode)13 UTF_8 (com.google.common.base.Charsets.UTF_8)1 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 URI (java.net.URI)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 Slf4j (lombok.extern.slf4j.Slf4j)1 CompareResult (org.apache.bookkeeper.api.kv.op.CompareResult)1 RangeOp (org.apache.bookkeeper.api.kv.op.RangeOp)1 TxnOp (org.apache.bookkeeper.api.kv.op.TxnOp)1 Options (org.apache.bookkeeper.api.kv.options.Options)1 Code (org.apache.bookkeeper.api.kv.result.Code)1 KeyValue (org.apache.bookkeeper.api.kv.result.KeyValue)1 FutureUtils (org.apache.bookkeeper.common.concurrent.FutureUtils)1 Bytes (org.apache.bookkeeper.common.util.Bytes)1 MVCCStoreException (org.apache.bookkeeper.statelib.api.exceptions.MVCCStoreException)1 MVCCAsyncStore (org.apache.bookkeeper.statelib.api.mvcc.MVCCAsyncStore)1 NamespaceMetadata (org.apache.bookkeeper.stream.proto.NamespaceMetadata)1 NamespaceProperties (org.apache.bookkeeper.stream.proto.NamespaceProperties)1 StreamConfiguration (org.apache.bookkeeper.stream.proto.StreamConfiguration)1