-
Notifications
You must be signed in to change notification settings - Fork 255
refactor: Add FileIO::remove_dir_all to deprecate remove_dir #1275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Xuanwo <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Xuanwo for this pr, just a nit!
@@ -95,9 +95,14 @@ impl FileIO { | |||
/// # Arguments | |||
/// | |||
/// * path: It should be *absolute* path starting with scheme string used to construct [`FileIO`]. | |||
pub async fn remove_all(&self, path: impl AsRef<str>) -> Result<()> { | |||
pub async fn remove_dir_all(&self, path: impl AsRef<str>) -> Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- It would be better to add doc to explain the behavior, e.g. what if the dir doesn't exist, what if the dir is empty.
- Add test case for path not ending with "/"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe also add a test for if the path (without ending in /
) refers to a file instead of dir. should be no-op
@@ -95,9 +95,14 @@ impl FileIO { | |||
/// # Arguments | |||
/// | |||
/// * path: It should be *absolute* path starting with scheme string used to construct [`FileIO`]. | |||
pub async fn remove_all(&self, path: impl AsRef<str>) -> Result<()> { | |||
pub async fn remove_dir_all(&self, path: impl AsRef<str>) -> Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a breaking change? i.e. something we should warn users about on the next release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, we could deprecate the old one, and recommend the new api.
@@ -95,9 +95,14 @@ impl FileIO { | |||
/// # Arguments | |||
/// | |||
/// * path: It should be *absolute* path starting with scheme string used to construct [`FileIO`]. | |||
pub async fn remove_all(&self, path: impl AsRef<str>) -> Result<()> { | |||
pub async fn remove_dir_all(&self, path: impl AsRef<str>) -> Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe also add a test for if the path (without ending in /
) refers to a file instead of dir. should be no-op
Thank you all for the review, I will start addressing them today. |
Signed-off-by: Xuanwo <[email protected]>
Which issue does this PR close?
remove_all
behavior for S3 #1118What changes are included in this PR?
Change FileIO::remove_all to remove_dir_all to make it's behavior more clear.
Are these changes tested?