HDDS-2163. Add 'Replication factor' to the output of list keys (#1493)

This commit is contained in:
Vivek Ratnavel Subramanian 2019-09-20 22:59:45 -07:00 committed by Bharat Viswanadham
parent efed4450bf
commit dbdc612b3b
4 changed files with 23 additions and 6 deletions

View File

@ -52,13 +52,17 @@ public class OzoneKey {
private ReplicationType replicationType;
private int replicationFactor;
/**
* Constructs OzoneKey from OmKeyInfo.
*
*/
@SuppressWarnings("parameternumber")
public OzoneKey(String volumeName, String bucketName,
String keyName, long size, long creationTime,
long modificationTime, ReplicationType type) {
long modificationTime, ReplicationType type,
int replicationFactor) {
this.volumeName = volumeName;
this.bucketName = bucketName;
this.name = keyName;
@ -66,6 +70,7 @@ public class OzoneKey {
this.creationTime = creationTime;
this.modificationTime = modificationTime;
this.replicationType = type;
this.replicationFactor = replicationFactor;
}
/**
@ -130,4 +135,14 @@ public class OzoneKey {
public ReplicationType getReplicationType() {
return replicationType;
}
/**
* Returns the replication factor of the key.
*
* @return replicationFactor
*/
public int getReplicationFactor() {
return replicationFactor;
}
}

View File

@ -46,9 +46,9 @@ public class OzoneKeyDetails extends OzoneKey {
long size, long creationTime, long modificationTime,
List<OzoneKeyLocation> ozoneKeyLocations,
ReplicationType type, Map<String, String> metadata,
FileEncryptionInfo feInfo) {
FileEncryptionInfo feInfo, int replicationFactor) {
super(volumeName, bucketName, keyName, size, creationTime,
modificationTime, type);
modificationTime, type, replicationFactor);
this.ozoneKeyLocations = ozoneKeyLocations;
this.metadata = metadata;
this.feInfo = feInfo;

View File

@ -684,7 +684,8 @@ public class RpcClient implements ClientProtocol {
key.getDataSize(),
key.getCreationTime(),
key.getModificationTime(),
ReplicationType.valueOf(key.getType().toString())))
ReplicationType.valueOf(key.getType().toString()),
key.getFactor().getNumber()))
.collect(Collectors.toList());
}
@ -712,7 +713,7 @@ public class RpcClient implements ClientProtocol {
keyInfo.getKeyName(), keyInfo.getDataSize(), keyInfo.getCreationTime(),
keyInfo.getModificationTime(), ozoneKeyLocations, ReplicationType
.valueOf(keyInfo.getType().toString()), keyInfo.getMetadata(),
keyInfo.getFileEncryptionInfo());
keyInfo.getFileEncryptionInfo(), keyInfo.getFactor().getNumber());
}
@Override

View File

@ -104,7 +104,8 @@ public class OzoneBucketStub extends OzoneBucket {
size,
System.currentTimeMillis(),
System.currentTimeMillis(),
new ArrayList<>(), type, metadata, null
new ArrayList<>(), type, metadata, null,
factor.getValue()
));
super.close();
}