Search in sources :

Example 1 with OmKeyArgs

use of org.apache.hadoop.ozone.om.helpers.OmKeyArgs in project ozone by apache.

the class RpcClient method getKey.

@Override
public OzoneInputStream getKey(String volumeName, String bucketName, String keyName) throws IOException {
    verifyVolumeName(volumeName);
    verifyBucketName(bucketName);
    Preconditions.checkNotNull(keyName);
    OmKeyArgs keyArgs = new OmKeyArgs.Builder().setVolumeName(volumeName).setBucketName(bucketName).setKeyName(keyName).setRefreshPipeline(true).setSortDatanodesInPipeline(topologyAwareReadEnabled).setLatestVersionLocation(getLatestVersionLocation).build();
    OmKeyInfo keyInfo = ozoneManagerClient.lookupKey(keyArgs);
    return getInputStreamWithRetryFunction(keyInfo);
}
Also used : OmKeyInfo(org.apache.hadoop.ozone.om.helpers.OmKeyInfo) RepeatedOmKeyInfo(org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo) OmKeyArgs(org.apache.hadoop.ozone.om.helpers.OmKeyArgs)

Example 2 with OmKeyArgs

use of org.apache.hadoop.ozone.om.helpers.OmKeyArgs in project ozone by apache.

the class RpcClient method createDirectory.

@Override
public void createDirectory(String volumeName, String bucketName, String keyName) throws IOException {
    OmKeyArgs keyArgs = new OmKeyArgs.Builder().setVolumeName(volumeName).setBucketName(bucketName).setKeyName(keyName).setAcls(getAclList()).build();
    ozoneManagerClient.createDirectory(keyArgs);
}
Also used : OmKeyArgs(org.apache.hadoop.ozone.om.helpers.OmKeyArgs)

Example 3 with OmKeyArgs

use of org.apache.hadoop.ozone.om.helpers.OmKeyArgs in project ozone by apache.

the class RpcClient method getKeyDetails.

@Override
public OzoneKeyDetails getKeyDetails(String volumeName, String bucketName, String keyName) throws IOException {
    Preconditions.checkNotNull(volumeName);
    Preconditions.checkNotNull(bucketName);
    Preconditions.checkNotNull(keyName);
    OmKeyArgs keyArgs = new OmKeyArgs.Builder().setVolumeName(volumeName).setBucketName(bucketName).setKeyName(keyName).setRefreshPipeline(true).setSortDatanodesInPipeline(topologyAwareReadEnabled).setLatestVersionLocation(getLatestVersionLocation).build();
    OmKeyInfo keyInfo = ozoneManagerClient.lookupKey(keyArgs);
    List<OzoneKeyLocation> ozoneKeyLocations = new ArrayList<>();
    long lastKeyOffset = 0L;
    List<OmKeyLocationInfo> omKeyLocationInfos = keyInfo.getLatestVersionLocations().getBlocksLatestVersionOnly();
    for (OmKeyLocationInfo info : omKeyLocationInfos) {
        ozoneKeyLocations.add(new OzoneKeyLocation(info.getContainerID(), info.getLocalID(), info.getLength(), info.getOffset(), lastKeyOffset));
        lastKeyOffset += info.getLength();
    }
    return new OzoneKeyDetails(keyInfo.getVolumeName(), keyInfo.getBucketName(), keyInfo.getKeyName(), keyInfo.getDataSize(), keyInfo.getCreationTime(), keyInfo.getModificationTime(), ozoneKeyLocations, keyInfo.getReplicationConfig(), keyInfo.getMetadata(), keyInfo.getFileEncryptionInfo());
}
Also used : OzoneKeyDetails(org.apache.hadoop.ozone.client.OzoneKeyDetails) OzoneKeyLocation(org.apache.hadoop.ozone.client.OzoneKeyLocation) OmKeyInfo(org.apache.hadoop.ozone.om.helpers.OmKeyInfo) RepeatedOmKeyInfo(org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo) ArrayList(java.util.ArrayList) OmKeyArgs(org.apache.hadoop.ozone.om.helpers.OmKeyArgs) OmKeyLocationInfo(org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfo)

Example 4 with OmKeyArgs

use of org.apache.hadoop.ozone.om.helpers.OmKeyArgs in project ozone by apache.

the class RpcClient method abortMultipartUpload.

@Override
public void abortMultipartUpload(String volumeName, String bucketName, String keyName, String uploadID) throws IOException {
    verifyVolumeName(volumeName);
    verifyBucketName(bucketName);
    HddsClientUtils.checkNotNull(keyName, uploadID);
    OmKeyArgs omKeyArgs = new OmKeyArgs.Builder().setVolumeName(volumeName).setBucketName(bucketName).setKeyName(keyName).setMultipartUploadID(uploadID).build();
    ozoneManagerClient.abortMultipartUpload(omKeyArgs);
}
Also used : OmKeyArgs(org.apache.hadoop.ozone.om.helpers.OmKeyArgs)

Example 5 with OmKeyArgs

use of org.apache.hadoop.ozone.om.helpers.OmKeyArgs in project ozone by apache.

the class RpcClient method completeMultipartUpload.

@Override
public OmMultipartUploadCompleteInfo completeMultipartUpload(String volumeName, String bucketName, String keyName, String uploadID, Map<Integer, String> partsMap) throws IOException {
    verifyVolumeName(volumeName);
    verifyBucketName(bucketName);
    HddsClientUtils.checkNotNull(keyName, uploadID);
    OmKeyArgs keyArgs = new OmKeyArgs.Builder().setVolumeName(volumeName).setBucketName(bucketName).setKeyName(keyName).setMultipartUploadID(uploadID).setAcls(getAclList()).build();
    OmMultipartUploadCompleteList omMultipartUploadCompleteList = new OmMultipartUploadCompleteList(partsMap);
    OmMultipartUploadCompleteInfo omMultipartUploadCompleteInfo = ozoneManagerClient.completeMultipartUpload(keyArgs, omMultipartUploadCompleteList);
    return omMultipartUploadCompleteInfo;
}
Also used : OmMultipartUploadCompleteInfo(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadCompleteInfo) OmMultipartUploadCompleteList(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadCompleteList) CacheBuilder(com.google.common.cache.CacheBuilder) OmKeyArgs(org.apache.hadoop.ozone.om.helpers.OmKeyArgs)

Aggregations

OmKeyArgs (org.apache.hadoop.ozone.om.helpers.OmKeyArgs)106 Test (org.junit.Test)46 OmKeyInfo (org.apache.hadoop.ozone.om.helpers.OmKeyInfo)45 OmKeyLocationInfo (org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfo)33 OzoneOutputStream (org.apache.hadoop.ozone.client.io.OzoneOutputStream)28 OpenKeySession (org.apache.hadoop.ozone.om.helpers.OpenKeySession)23 ContainerInfo (org.apache.hadoop.hdds.scm.container.ContainerInfo)20 KeyArgs (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyArgs)19 ArrayList (java.util.ArrayList)18 DatanodeDetails (org.apache.hadoop.hdds.protocol.DatanodeDetails)18 Pipeline (org.apache.hadoop.hdds.scm.pipeline.Pipeline)18 KeyOutputStream (org.apache.hadoop.ozone.client.io.KeyOutputStream)17 OzoneFileStatus (org.apache.hadoop.ozone.om.helpers.OzoneFileStatus)17 DeleteKeyArgs (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DeleteKeyArgs)15 OMRequest (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest)15 RepeatedOmKeyInfo (org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo)13 IOException (java.io.IOException)10 OMException (org.apache.hadoop.ozone.om.exceptions.OMException)9 BlockID (org.apache.hadoop.hdds.client.BlockID)8 OzoneBucket (org.apache.hadoop.ozone.client.OzoneBucket)8