HDDS-2163. Add 'Replication factor' to the output of list keys (#1493)
This commit is contained in:
parent
efed4450bf
commit
dbdc612b3b
@ -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 OzoneKey(String volumeName, String bucketName,
|
||||
this.creationTime = creationTime;
|
||||
this.modificationTime = modificationTime;
|
||||
this.replicationType = type;
|
||||
this.replicationFactor = replicationFactor;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -130,4 +135,14 @@ public long getModificationTime() {
|
||||
public ReplicationType getReplicationType() {
|
||||
return replicationType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the replication factor of the key.
|
||||
*
|
||||
* @return replicationFactor
|
||||
*/
|
||||
public int getReplicationFactor() {
|
||||
return replicationFactor;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -46,9 +46,9 @@ public OzoneKeyDetails(String volumeName, String bucketName, String keyName,
|
||||
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;
|
||||
|
@ -684,7 +684,8 @@ public List<OzoneKey> listKeys(String volumeName, String bucketName,
|
||||
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 OzoneKeyDetails getKeyDetails(
|
||||
keyInfo.getKeyName(), keyInfo.getDataSize(), keyInfo.getCreationTime(),
|
||||
keyInfo.getModificationTime(), ozoneKeyLocations, ReplicationType
|
||||
.valueOf(keyInfo.getType().toString()), keyInfo.getMetadata(),
|
||||
keyInfo.getFileEncryptionInfo());
|
||||
keyInfo.getFileEncryptionInfo(), keyInfo.getFactor().getNumber());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -104,7 +104,8 @@ public void close() throws IOException {
|
||||
size,
|
||||
System.currentTimeMillis(),
|
||||
System.currentTimeMillis(),
|
||||
new ArrayList<>(), type, metadata, null
|
||||
new ArrayList<>(), type, metadata, null,
|
||||
factor.getValue()
|
||||
));
|
||||
super.close();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user