Skip to content

Commit b154bc1

Browse files
author
gitlab
committed
Merge branch 'fix/ZSTAC-82318-phase2' into '5.5.12'
<feature>[longjob]: standardize progress detail fields to be unit-agnostic See merge request zstackio/zstack!9358
2 parents 327b1cc + dc67d72 commit b154bc1

4 files changed

Lines changed: 198 additions & 300 deletions

File tree

header/src/main/java/org/zstack/header/core/progress/APIGetTaskProgressReply.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ public static APIGetTaskProgressReply __example__() {
3535
detail.setPercent(42);
3636
detail.setStage("downloading");
3737
detail.setState("running");
38-
detail.setProcessedBytes(440401920L);
39-
detail.setTotalBytes(1073741824L);
40-
detail.setSpeedBytesPerSecond(10485760L);
38+
detail.setProcessed(440401920L);
39+
detail.setTotal(1073741824L);
40+
detail.setUnit("bytes");
41+
detail.setSpeed(10485760L);
4142
detail.setEstimatedRemainingSeconds(60L);
4243
inv.setProgressDetail(detail);
4344

header/src/main/java/org/zstack/header/core/progress/LongJobProgressDetail.java

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,23 @@ public class LongJobProgressDetail {
2121
/** Human-readable reason for current state. */
2222
private String stateReason;
2323

24-
/** Bytes already processed. */
25-
private Long processedBytes;
24+
/** Amount already processed (unit described by the {@code unit} field). */
25+
private Long processed;
2626

27-
/** Total bytes to process. */
28-
private Long totalBytes;
27+
/** Total amount to process (unit described by the {@code unit} field). */
28+
private Long total;
2929

3030
/** Items already processed (e.g. files, chunks). */
3131
private Long processedItems;
3232

3333
/** Total items to process. */
3434
private Long totalItems;
3535

36-
/** Transfer speed in bytes/s. */
37-
private Long speedBytesPerSecond;
36+
/** Processing speed per second (unit described by the {@code unit} field). */
37+
private Long speed;
38+
39+
/** Unit for processed/total/speed, e.g. "bytes", "items", "steps". */
40+
private String unit;
3841

3942
/** Estimated remaining time in seconds. */
4043
private Long estimatedRemainingSeconds;
@@ -77,20 +80,20 @@ public void setStateReason(String stateReason) {
7780
this.stateReason = stateReason;
7881
}
7982

80-
public Long getProcessedBytes() {
81-
return processedBytes;
83+
public Long getProcessed() {
84+
return processed;
8285
}
8386

84-
public void setProcessedBytes(Long processedBytes) {
85-
this.processedBytes = processedBytes;
87+
public void setProcessed(Long processed) {
88+
this.processed = processed;
8689
}
8790

88-
public Long getTotalBytes() {
89-
return totalBytes;
91+
public Long getTotal() {
92+
return total;
9093
}
9194

92-
public void setTotalBytes(Long totalBytes) {
93-
this.totalBytes = totalBytes;
95+
public void setTotal(Long total) {
96+
this.total = total;
9497
}
9598

9699
public Long getProcessedItems() {
@@ -109,12 +112,20 @@ public void setTotalItems(Long totalItems) {
109112
this.totalItems = totalItems;
110113
}
111114

112-
public Long getSpeedBytesPerSecond() {
113-
return speedBytesPerSecond;
115+
public Long getSpeed() {
116+
return speed;
117+
}
118+
119+
public void setSpeed(Long speed) {
120+
this.speed = speed;
121+
}
122+
123+
public String getUnit() {
124+
return unit;
114125
}
115126

116-
public void setSpeedBytesPerSecond(Long speedBytesPerSecond) {
117-
this.speedBytesPerSecond = speedBytesPerSecond;
127+
public void setUnit(String unit) {
128+
this.unit = unit;
118129
}
119130

120131
public Long getEstimatedRemainingSeconds() {

0 commit comments

Comments
 (0)