Skip to content

Commit 2602674

Browse files
authored
This PR is to add comments to patchDatasetStatus in pkg\ddc\alluxio\cache.go. (#4578)
* Add Notation to patchDatasetStatus in pkg\ddc\alluxio\cache.go Signed-off-by: Volta234 <3313467495@qq.com> * Add Notation to patchDatasetStatus in pkg\ddc\alluxio\cache.go Signed-off-by: Volta234 <3313467495@qq.com> --------- Signed-off-by: Volta234 <3313467495@qq.com>
1 parent 8103be4 commit 2602674

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

pkg/ddc/alluxio/cache.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,21 @@ func (e *AlluxioEngine) queryCacheStatus() (states cacheStates, err error) {
6363

6464
}
6565

66+
// PatchDatasetStatus updates the Dataset status with cached percentage based on the provided cache states.
67+
// It skips updating under the following conditions:
68+
// - When the Dataset's UfsTotal field is empty
69+
// - When the Dataset's UfsTotal field contains the metadata sync pending message
70+
// The cached percentage is calculated as (cached bytes / UfsTotal bytes) * 100.
71+
//
72+
// Parameters:
73+
// - dataset (v1alpha1.Dataset): Pointer to the Dataset object containing UFS metadata.
74+
// The Status.UfsTotal field must be a valid human-readable size string (e.g. "10GiB")
75+
// - states (cacheStates): Pointer to the cache state structure that will be modified in-place.
76+
// The cached field must be a valid human-readable size string (e.g. "5GiB")
77+
//
78+
// Returns:
79+
// - None: Modifies the states.cachedPercentage field directly with formatted percentage string.
80+
// The percentage is stored as a string using cachedPercentageFormat (e.g. "45.60%")
6681
func (e AlluxioEngine) patchDatasetStatus(dataset *v1alpha1.Dataset, states *cacheStates) {
6782
// skip when `dataset.Status.UfsTotal` is empty
6883
if dataset.Status.UfsTotal == "" {

0 commit comments

Comments
 (0)