use of org.apache.hadoop.ozone.om.helpers.OmKeyArgs in project ozone by apache.
the class TestTrashService method createAndDeleteKey.
private void createAndDeleteKey(String keyName) throws IOException {
OMRequestTestUtils.addVolumeToOM(keyManager.getMetadataManager(), OmVolumeArgs.newBuilder().setOwnerName("owner").setAdminName("admin").setVolume(volumeName).build());
OMRequestTestUtils.addBucketToOM(keyManager.getMetadataManager(), OmBucketInfo.newBuilder().setVolumeName(volumeName).setBucketName(bucketName).build());
OmKeyArgs keyArgs = new OmKeyArgs.Builder().setVolumeName(volumeName).setBucketName(bucketName).setKeyName(keyName).setAcls(Collections.emptyList()).setLocationInfoList(new ArrayList<>()).setReplicationConfig(StandaloneReplicationConfig.getInstance(HddsProtos.ReplicationFactor.ONE)).build();
/* Create and delete key in the Key Manager. */
OpenKeySession session = writeClient.openKey(keyArgs);
writeClient.commitKey(keyArgs, session.getId());
writeClient.deleteKey(keyArgs);
}
use of org.apache.hadoop.ozone.om.helpers.OmKeyArgs in project ozone by apache.
the class TestKeyManagerUnit method initMultipartUpload.
private OmMultipartInfo initMultipartUpload(OzoneManagerProtocol omtest, String volume, String bucket, String key) throws IOException {
OmKeyArgs key1 = new Builder().setVolumeName(volume).setBucketName(bucket).setKeyName(key).setReplicationConfig(RatisReplicationConfig.getInstance(ReplicationFactor.THREE)).setAcls(new ArrayList<>()).build();
OmMultipartInfo omMultipartInfo = omtest.initiateMultipartUpload(key1);
return omMultipartInfo;
}
use of org.apache.hadoop.ozone.om.helpers.OmKeyArgs in project ozone by apache.
the class OmKeyGenerator method createKey.
private void createKey(long counter) throws Exception {
UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
OmKeyArgs keyArgs = new Builder().setBucketName(bucketName).setVolumeName(volumeName).setReplicationConfig(RatisReplicationConfig.getInstance(factor)).setKeyName(generateObjectName(counter)).setLocationInfoList(new ArrayList<>()).setAcls(OzoneAclUtil.getAclList(ugi.getUserName(), ugi.getGroupNames(), ALL, ALL)).build();
timer.time(() -> {
OpenKeySession openKeySession = ozoneManagerClient.openKey(keyArgs);
ozoneManagerClient.commitKey(keyArgs, openKeySession.getId());
return null;
});
}
use of org.apache.hadoop.ozone.om.helpers.OmKeyArgs in project ozone by apache.
the class OzoneManagerProtocolClientSideTranslatorPB method deleteKey.
/**
* Deletes an existing key.
*
* @param args the args of the key.
* @throws IOException
*/
@Override
public void deleteKey(OmKeyArgs args) throws IOException {
DeleteKeyRequest.Builder req = DeleteKeyRequest.newBuilder();
KeyArgs keyArgs = KeyArgs.newBuilder().setVolumeName(args.getVolumeName()).setBucketName(args.getBucketName()).setKeyName(args.getKeyName()).setRecursive(args.isRecursive()).build();
req.setKeyArgs(keyArgs);
OMRequest omRequest = createOMRequest(Type.DeleteKey).setDeleteKeyRequest(req).build();
handleError(submitRequest(omRequest));
}
use of org.apache.hadoop.ozone.om.helpers.OmKeyArgs in project ozone by apache.
the class OzoneManagerProtocolClientSideTranslatorPB method abortMultipartUpload.
@Override
public void abortMultipartUpload(OmKeyArgs omKeyArgs) throws IOException {
KeyArgs.Builder keyArgs = KeyArgs.newBuilder().setVolumeName(omKeyArgs.getVolumeName()).setBucketName(omKeyArgs.getBucketName()).setKeyName(omKeyArgs.getKeyName()).setMultipartUploadID(omKeyArgs.getMultipartUploadID());
MultipartUploadAbortRequest.Builder multipartUploadAbortRequest = MultipartUploadAbortRequest.newBuilder();
multipartUploadAbortRequest.setKeyArgs(keyArgs);
OMRequest omRequest = createOMRequest(Type.AbortMultiPartUpload).setAbortMultiPartUploadRequest(multipartUploadAbortRequest.build()).build();
handleError(submitRequest(omRequest));
}
Aggregations