Skip to content
Open
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
10 changes: 10 additions & 0 deletions pkg/ddc/alluxio/ufs.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ func (e *AlluxioEngine) ShouldUpdateUFS() (ufsToUpdate *utils.UFSToUpdate) {
return
}

// UpdateOnUFSChange handles the updates when the Underlying File System (UFS) changes.
// It checks if an update is required, sets the dataset status to Updating, and processes
// the added or removed mount points for the Alluxio engine.
//
// Parameters:
// - ufsToUpdate (*utils.UFSToUpdate): The object containing information about which UFS paths need to be updated.
//
// Returns:
// - updateReady (bool): Indicates whether the update process is ready or completed.
// - err (error): Returns an error if the status update or UFS processing fails, otherwise returns nil.
Comment on lines +137 to +146
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The documentation for the return value updateReady could be more precise. Currently, it returns false when no update is required, which might be slightly confusing if interpreted as the system not being 'ready'. Additionally, the description of the function's behavior could be clarified to indicate that the status is only set to 'Updating' if an update is actually needed. There is also a trailing whitespace at the end of line 138.

Suggested change
// UpdateOnUFSChange handles the updates when the Underlying File System (UFS) changes.
// It checks if an update is required, sets the dataset status to Updating, and processes
// the added or removed mount points for the Alluxio engine.
//
// Parameters:
// - ufsToUpdate (*utils.UFSToUpdate): The object containing information about which UFS paths need to be updated.
//
// Returns:
// - updateReady (bool): Indicates whether the update process is ready or completed.
// - err (error): Returns an error if the status update or UFS processing fails, otherwise returns nil.
// UpdateOnUFSChange handles the updates when the Underlying File System (UFS) changes.
// It checks if an update is required, and if so, sets the dataset status to Updating
// and processes the added or removed mount points for the Alluxio engine.
//
// Parameters:
// - ufsToUpdate (*utils.UFSToUpdate): The object containing information about which UFS paths need to be updated.
//
// Returns:
// - updateReady (bool): Returns true if the update was successfully performed, or false if no update was needed or an error occurred.
// - err (error): Returns an error if the status update or UFS processing fails, otherwise returns nil.

func (e *AlluxioEngine) UpdateOnUFSChange(ufsToUpdate *utils.UFSToUpdate) (updateReady bool, err error) {
// 1. check if need to update ufs
if !ufsToUpdate.ShouldUpdate() {
Expand Down