use of org.apache.hadoop.ozone.om.request.key.OMKeysDeleteRequest in project ozone by apache.
the class OMKeyRequestFactory method createRequest.
/**
* Create OM request based on the bucket layout type.
*
* @param omRequest om key request
* @param ozoneManager ozone manager
* @return omKeyRequest
* @throws IOException
*/
public static OMKeyRequest createRequest(OMRequest omRequest, OzoneManager ozoneManager) throws IOException {
Type cmdType = omRequest.getCmdType();
KeyArgs keyArgs;
OMKeyRequest omKeyRequest = null;
switch(cmdType) {
case CreateDirectory:
keyArgs = omRequest.getCreateDirectoryRequest().getKeyArgs();
omKeyRequest = OMDirectoryCreateRequest.getInstance(keyArgs, omRequest, ozoneManager);
break;
case CreateFile:
keyArgs = omRequest.getCreateFileRequest().getKeyArgs();
omKeyRequest = OMFileCreateRequest.getInstance(keyArgs, omRequest, ozoneManager);
break;
case CreateKey:
keyArgs = omRequest.getCreateKeyRequest().getKeyArgs();
omKeyRequest = OMKeyCreateRequest.getInstance(keyArgs, omRequest, ozoneManager);
break;
case AllocateBlock:
keyArgs = omRequest.getAllocateBlockRequest().getKeyArgs();
omKeyRequest = OMAllocateBlockRequest.getInstance(keyArgs, omRequest, ozoneManager);
break;
case CommitKey:
keyArgs = omRequest.getCommitKeyRequest().getKeyArgs();
omKeyRequest = OMKeyCommitRequest.getInstance(keyArgs, omRequest, ozoneManager);
break;
case DeleteKey:
keyArgs = omRequest.getDeleteKeyRequest().getKeyArgs();
omKeyRequest = OMKeyDeleteRequest.getInstance(keyArgs, omRequest, ozoneManager);
break;
case DeleteKeys:
return new OMKeysDeleteRequest(omRequest);
case RenameKey:
keyArgs = omRequest.getRenameKeyRequest().getKeyArgs();
omKeyRequest = OMKeyRenameRequest.getInstance(keyArgs, omRequest, ozoneManager);
break;
case RenameKeys:
return new OMKeysRenameRequest(omRequest);
case PurgeKeys:
omKeyRequest = new OMKeyPurgeRequest(omRequest);
break;
case PurgePaths:
omKeyRequest = new OMPathsPurgeRequestWithFSO(omRequest);
break;
case InitiateMultiPartUpload:
keyArgs = omRequest.getInitiateMultiPartUploadRequest().getKeyArgs();
omKeyRequest = S3InitiateMultipartUploadRequest.getInstance(keyArgs, omRequest, ozoneManager);
break;
case CommitMultiPartUpload:
keyArgs = omRequest.getCommitMultiPartUploadRequest().getKeyArgs();
omKeyRequest = S3MultipartUploadCommitPartRequest.getInstance(keyArgs, omRequest, ozoneManager);
break;
case AbortMultiPartUpload:
keyArgs = omRequest.getAbortMultiPartUploadRequest().getKeyArgs();
omKeyRequest = S3MultipartUploadAbortRequest.getInstance(keyArgs, omRequest, ozoneManager);
break;
case CompleteMultiPartUpload:
keyArgs = omRequest.getCompleteMultiPartUploadRequest().getKeyArgs();
omKeyRequest = S3MultipartUploadCompleteRequest.getInstance(keyArgs, omRequest, ozoneManager);
break;
default:
// #createRequest() method.
break;
}
return omKeyRequest;
}
Aggregations