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 ReplicationType replicationType;
|
||||||
|
|
||||||
|
private int replicationFactor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs OzoneKey from OmKeyInfo.
|
* Constructs OzoneKey from OmKeyInfo.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("parameternumber")
|
||||||
public OzoneKey(String volumeName, String bucketName,
|
public OzoneKey(String volumeName, String bucketName,
|
||||||
String keyName, long size, long creationTime,
|
String keyName, long size, long creationTime,
|
||||||
long modificationTime, ReplicationType type) {
|
long modificationTime, ReplicationType type,
|
||||||
|
int replicationFactor) {
|
||||||
this.volumeName = volumeName;
|
this.volumeName = volumeName;
|
||||||
this.bucketName = bucketName;
|
this.bucketName = bucketName;
|
||||||
this.name = keyName;
|
this.name = keyName;
|
||||||
@ -66,6 +70,7 @@ public OzoneKey(String volumeName, String bucketName,
|
|||||||
this.creationTime = creationTime;
|
this.creationTime = creationTime;
|
||||||
this.modificationTime = modificationTime;
|
this.modificationTime = modificationTime;
|
||||||
this.replicationType = type;
|
this.replicationType = type;
|
||||||
|
this.replicationFactor = replicationFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -130,4 +135,14 @@ public long getModificationTime() {
|
|||||||
public ReplicationType getReplicationType() {
|
public ReplicationType getReplicationType() {
|
||||||
return replicationType;
|
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,
|
long size, long creationTime, long modificationTime,
|
||||||
List<OzoneKeyLocation> ozoneKeyLocations,
|
List<OzoneKeyLocation> ozoneKeyLocations,
|
||||||
ReplicationType type, Map<String, String> metadata,
|
ReplicationType type, Map<String, String> metadata,
|
||||||
FileEncryptionInfo feInfo) {
|
FileEncryptionInfo feInfo, int replicationFactor) {
|
||||||
super(volumeName, bucketName, keyName, size, creationTime,
|
super(volumeName, bucketName, keyName, size, creationTime,
|
||||||
modificationTime, type);
|
modificationTime, type, replicationFactor);
|
||||||
this.ozoneKeyLocations = ozoneKeyLocations;
|
this.ozoneKeyLocations = ozoneKeyLocations;
|
||||||
this.metadata = metadata;
|
this.metadata = metadata;
|
||||||
this.feInfo = feInfo;
|
this.feInfo = feInfo;
|
||||||
|
@ -684,7 +684,8 @@ public List<OzoneKey> listKeys(String volumeName, String bucketName,
|
|||||||
key.getDataSize(),
|
key.getDataSize(),
|
||||||
key.getCreationTime(),
|
key.getCreationTime(),
|
||||||
key.getModificationTime(),
|
key.getModificationTime(),
|
||||||
ReplicationType.valueOf(key.getType().toString())))
|
ReplicationType.valueOf(key.getType().toString()),
|
||||||
|
key.getFactor().getNumber()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -712,7 +713,7 @@ public OzoneKeyDetails getKeyDetails(
|
|||||||
keyInfo.getKeyName(), keyInfo.getDataSize(), keyInfo.getCreationTime(),
|
keyInfo.getKeyName(), keyInfo.getDataSize(), keyInfo.getCreationTime(),
|
||||||
keyInfo.getModificationTime(), ozoneKeyLocations, ReplicationType
|
keyInfo.getModificationTime(), ozoneKeyLocations, ReplicationType
|
||||||
.valueOf(keyInfo.getType().toString()), keyInfo.getMetadata(),
|
.valueOf(keyInfo.getType().toString()), keyInfo.getMetadata(),
|
||||||
keyInfo.getFileEncryptionInfo());
|
keyInfo.getFileEncryptionInfo(), keyInfo.getFactor().getNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -104,7 +104,8 @@ public void close() throws IOException {
|
|||||||
size,
|
size,
|
||||||
System.currentTimeMillis(),
|
System.currentTimeMillis(),
|
||||||
System.currentTimeMillis(),
|
System.currentTimeMillis(),
|
||||||
new ArrayList<>(), type, metadata, null
|
new ArrayList<>(), type, metadata, null,
|
||||||
|
factor.getValue()
|
||||||
));
|
));
|
||||||
super.close();
|
super.close();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user