Search in sources :

Example 1 with OMKeysRenameRequest

use of org.apache.hadoop.ozone.om.request.key.OMKeysRenameRequest 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;
}
Also used : OMPathsPurgeRequestWithFSO(org.apache.hadoop.ozone.om.request.key.OMPathsPurgeRequestWithFSO) Type(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Type) OMKeyPurgeRequest(org.apache.hadoop.ozone.om.request.key.OMKeyPurgeRequest) OMKeysDeleteRequest(org.apache.hadoop.ozone.om.request.key.OMKeysDeleteRequest) KeyArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyArgs) OMKeysRenameRequest(org.apache.hadoop.ozone.om.request.key.OMKeysRenameRequest) OMKeyRequest(org.apache.hadoop.ozone.om.request.key.OMKeyRequest)

Aggregations

OMKeyPurgeRequest (org.apache.hadoop.ozone.om.request.key.OMKeyPurgeRequest)1 OMKeyRequest (org.apache.hadoop.ozone.om.request.key.OMKeyRequest)1 OMKeysDeleteRequest (org.apache.hadoop.ozone.om.request.key.OMKeysDeleteRequest)1 OMKeysRenameRequest (org.apache.hadoop.ozone.om.request.key.OMKeysRenameRequest)1 OMPathsPurgeRequestWithFSO (org.apache.hadoop.ozone.om.request.key.OMPathsPurgeRequestWithFSO)1 KeyArgs (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyArgs)1 Type (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Type)1