Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions pkg/ddc/alluxio/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@ func (e *AlluxioEngine) queryCacheStatus() (states cacheStates, err error) {

}

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