xichen01 commented on code in PR #5388:
URL: https://github.com/apache/ozone/pull/5388#discussion_r1345946845


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeUsage.java:
##########
@@ -65,6 +65,11 @@ public long getAvailable() {
     return source.getAvailable() - getRemainingReserved();
   }
 
+  public long getAvailable(PrecomputedVolumeSpace precomputedVolumeSpace) {
+    long available = source.getAvailable();

Review Comment:
   Yes,  have been modified.



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeUsage.java:
##########
@@ -145,4 +161,32 @@ public static long 
getMinVolumeFreeSpace(ConfigurationSource conf,
         HDDS_DATANODE_VOLUME_MIN_FREE_SPACE_DEFAULT, StorageUnit.BYTES);
 
   }
+
+  /**
+   * Class representing precomputed space values of a volume.
+   * This class is intended to store precomputed values, such as capacity
+   * and available space of a volume, to avoid recalculating these
+   * values multiple times and to make method signatures simpler.
+   */
+  public static class PrecomputedVolumeSpace {
+    private final long capacity;
+    private final long available;
+
+    public PrecomputedVolumeSpace(long capacity, long available) {
+      this.capacity = capacity;
+      this.available = available;
+    }
+
+    public long getCapacity() {
+      return capacity;
+    }
+
+    public long getAvailable() {
+      return available;
+    }
+  }
+
+  public PrecomputedVolumeSpace getPrecomputedVolumeSpace() {
+    return new PrecomputedVolumeSpace(getCapacity(), getAvailable());

Review Comment:
   Yes, This should be new `PrecomputedVolumeSpace(source.getCapacity(), 
source.getAvailable())`  instead of `new PrecomputedVolumeSpace(getCapacity(), 
getAvailable())`, this have been corrected



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to