You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "suyanhanx (via GitHub)" <gi...@apache.org> on 2023/04/06 04:56:46 UTC
[GitHub] [incubator-opendal] suyanhanx opened a new pull request, #1862: feat(core): Support move
suyanhanx opened a new pull request, #1862:
URL: https://github.com/apache/incubator-opendal/pull/1862
part of #362
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-opendal] Ji-Xinyou commented on a diff in pull request #1862: feat(core): Support move
Posted by "Ji-Xinyou (via GitHub)" <gi...@apache.org>.
Ji-Xinyou commented on code in PR #1862:
URL: https://github.com/apache/incubator-opendal/pull/1862#discussion_r1159360627
##########
core/src/types/operator/operator.rs:
##########
@@ -603,6 +603,64 @@ impl Operator {
Ok(())
}
+ /// Move a file from `from` to `to`.
+ ///
+ /// # Notes
+ ///
+ /// - `from` and `to` must be a file.
+ /// - `to` will be overwritten if it exists.
+ /// - If `from` and `to` are the same, a `IsSameFile` error will occur.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// # use std::io::Result;
+ /// # use opendal::Operator;
+ ///
+ /// # #[tokio::main]
+ /// # async fn test(op: Operator) -> Result<()> {
+ /// op.move_("path/to/file", "path/to/file2").await?;
+ /// # Ok(())
+ /// # }
+ /// ```
+ pub async fn move_(&self, from: &str, to: &str) -> Result<()> {
Review Comment:
What about `mv`, a little bit vague tho.
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-opendal] Xuanwo merged pull request #1862: feat(core): Support rename
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo merged PR #1862:
URL: https://github.com/apache/incubator-opendal/pull/1862
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #1862: feat(core): Support move
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #1862:
URL: https://github.com/apache/incubator-opendal/pull/1862#discussion_r1159473115
##########
core/src/types/operator/operator.rs:
##########
@@ -603,6 +603,64 @@ impl Operator {
Ok(())
}
+ /// Move a file from `from` to `to`.
+ ///
+ /// # Notes
+ ///
+ /// - `from` and `to` must be a file.
+ /// - `to` will be overwritten if it exists.
+ /// - If `from` and `to` are the same, a `IsSameFile` error will occur.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// # use std::io::Result;
+ /// # use opendal::Operator;
+ ///
+ /// # #[tokio::main]
+ /// # async fn test(op: Operator) -> Result<()> {
+ /// op.move_("path/to/file", "path/to/file2").await?;
+ /// # Ok(())
+ /// # }
+ /// ```
+ pub async fn move_(&self, from: &str, to: &str) -> Result<()> {
Review Comment:
> What about `mv`, a little bit vague tho.
I prefer to use a full word instead of abbr.
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #1862: feat(core): Support move
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #1862:
URL: https://github.com/apache/incubator-opendal/pull/1862#discussion_r1159471729
##########
core/src/types/operator/operator.rs:
##########
@@ -603,6 +603,64 @@ impl Operator {
Ok(())
}
+ /// Move a file from `from` to `to`.
+ ///
+ /// # Notes
+ ///
+ /// - `from` and `to` must be a file.
+ /// - `to` will be overwritten if it exists.
+ /// - If `from` and `to` are the same, a `IsSameFile` error will occur.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// # use std::io::Result;
+ /// # use opendal::Operator;
+ ///
+ /// # #[tokio::main]
+ /// # async fn test(op: Operator) -> Result<()> {
+ /// op.move_("path/to/file", "path/to/file2").await?;
+ /// # Ok(())
+ /// # }
+ /// ```
+ pub async fn move_(&self, from: &str, to: &str) -> Result<()> {
Review Comment:
Oh, you are right. Let's use `rename`.
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-opendal] suyanhanx commented on a diff in pull request #1862: feat(core): Support move
Posted by "suyanhanx (via GitHub)" <gi...@apache.org>.
suyanhanx commented on code in PR #1862:
URL: https://github.com/apache/incubator-opendal/pull/1862#discussion_r1159283180
##########
core/src/types/operator/operator.rs:
##########
@@ -603,6 +603,64 @@ impl Operator {
Ok(())
}
+ /// Move a file from `from` to `to`.
+ ///
+ /// # Notes
+ ///
+ /// - `from` and `to` must be a file.
+ /// - `to` will be overwritten if it exists.
+ /// - If `from` and `to` are the same, a `IsSameFile` error will occur.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// # use std::io::Result;
+ /// # use opendal::Operator;
+ ///
+ /// # #[tokio::main]
+ /// # async fn test(op: Operator) -> Result<()> {
+ /// op.move_("path/to/file", "path/to/file2").await?;
+ /// # Ok(())
+ /// # }
+ /// ```
+ pub async fn move_(&self, from: &str, to: &str) -> Result<()> {
Review Comment:
Since `move` is a keyword, it is named as such. We can also choose other names.
(That said, the `rename` of `std::fs` is not named for the same reason, right?)
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-opendal] suyanhanx commented on a diff in pull request #1862: feat(core): Support move
Posted by "suyanhanx (via GitHub)" <gi...@apache.org>.
suyanhanx commented on code in PR #1862:
URL: https://github.com/apache/incubator-opendal/pull/1862#discussion_r1159283180
##########
core/src/types/operator/operator.rs:
##########
@@ -603,6 +603,64 @@ impl Operator {
Ok(())
}
+ /// Move a file from `from` to `to`.
+ ///
+ /// # Notes
+ ///
+ /// - `from` and `to` must be a file.
+ /// - `to` will be overwritten if it exists.
+ /// - If `from` and `to` are the same, a `IsSameFile` error will occur.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// # use std::io::Result;
+ /// # use opendal::Operator;
+ ///
+ /// # #[tokio::main]
+ /// # async fn test(op: Operator) -> Result<()> {
+ /// op.move_("path/to/file", "path/to/file2").await?;
+ /// # Ok(())
+ /// # }
+ /// ```
+ pub async fn move_(&self, from: &str, to: &str) -> Result<()> {
Review Comment:
Since `move` is a keyword, it is named as such. We can also choose other names.
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org