use of io.dingodb.store.row.cmd.store.NoRegionFoundResponse in project dingo by dingodb.
the class KVCommandProcessor method handleRequest.
@Override
public void handleRequest(final RpcContext rpcCtx, final T request) {
Requires.requireNonNull(request, "request");
final RequestProcessClosure<BaseRequest, BaseResponse<?>> closure = new RequestProcessClosure<>(request, rpcCtx);
final RegionKVService regionKVService = this.storeEngine.getRegionKVService(request.getRegionId());
if (regionKVService == null) {
final NoRegionFoundResponse noRegion = new NoRegionFoundResponse();
noRegion.setRegionId(request.getRegionId());
noRegion.setError(Errors.NO_REGION_FOUND);
noRegion.setValue(false);
closure.sendResponse(noRegion);
return;
}
switch(request.magic()) {
case BaseRequest.PUT:
regionKVService.handlePutRequest((PutRequest) request, closure);
break;
case BaseRequest.BATCH_PUT:
regionKVService.handleBatchPutRequest((BatchPutRequest) request, closure);
break;
case BaseRequest.PUT_IF_ABSENT:
regionKVService.handlePutIfAbsentRequest((PutIfAbsentRequest) request, closure);
break;
case BaseRequest.GET_PUT:
regionKVService.handleGetAndPutRequest((GetAndPutRequest) request, closure);
break;
case BaseRequest.COMPARE_PUT:
regionKVService.handleCompareAndPutRequest((CompareAndPutRequest) request, closure);
break;
case BaseRequest.DELETE:
regionKVService.handleDeleteRequest((DeleteRequest) request, closure);
break;
case BaseRequest.DELETE_RANGE:
regionKVService.handleDeleteRangeRequest((DeleteRangeRequest) request, closure);
break;
case BaseRequest.BATCH_DELETE:
regionKVService.handleBatchDeleteRequest((BatchDeleteRequest) request, closure);
break;
case BaseRequest.MERGE:
regionKVService.handleMergeRequest((MergeRequest) request, closure);
break;
case BaseRequest.GET:
regionKVService.handleGetRequest((GetRequest) request, closure);
break;
case BaseRequest.MULTI_GET:
regionKVService.handleMultiGetRequest((MultiGetRequest) request, closure);
break;
case BaseRequest.CONTAINS_KEY:
regionKVService.handleContainsKeyRequest((ContainsKeyRequest) request, closure);
break;
case BaseRequest.SCAN:
regionKVService.handleScanRequest((ScanRequest) request, closure);
break;
case BaseRequest.GET_SEQUENCE:
regionKVService.handleGetSequence((GetSequenceRequest) request, closure);
break;
case BaseRequest.RESET_SEQUENCE:
regionKVService.handleResetSequence((ResetSequenceRequest) request, closure);
break;
case BaseRequest.KEY_LOCK:
regionKVService.handleKeyLockRequest((KeyLockRequest) request, closure);
break;
case BaseRequest.KEY_UNLOCK:
regionKVService.handleKeyUnlockRequest((KeyUnlockRequest) request, closure);
break;
case BaseRequest.NODE_EXECUTE:
regionKVService.handleNodeExecuteRequest((NodeExecuteRequest) request, closure);
break;
case BaseRequest.RANGE_SPLIT:
regionKVService.handleRangeSplitRequest((RangeSplitRequest) request, closure);
break;
case BaseRequest.COMPARE_PUT_ALL:
regionKVService.handleCompareAndPutAll((CASAllRequest) request, closure);
break;
default:
throw new DingoRowStoreRuntimeException("Unsupported request type: " + request.getClass().getName());
}
}
Aggregations