You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Xuanwo (via GitHub)" <gi...@apache.org> on 2023/04/02 17:49:38 UTC
[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #1841: feat(core): basic copy
Xuanwo commented on code in PR #1841:
URL: https://github.com/apache/incubator-opendal/pull/1841#discussion_r1155350447
##########
core/src/layers/logging.rs:
##########
@@ -322,6 +322,47 @@ impl<A: Accessor> LayeredAccessor for LoggingAccessor<A> {
})
}
+ async fn copy(&self, from: &str, to: &str, args: OpCopy) -> Result<RpCopy> {
Review Comment:
You don't have to support all layers when adding a new operation for `Accessor`, but thank you for your effort!
##########
core/src/types/operator/operator.rs:
##########
@@ -544,6 +544,13 @@ impl Operator {
self.write_with(path, OpWrite::new(), bs).await
}
+ /// Copy a file from `from` to `to`.
+ pub async fn copy(&self, from: &str, to: &str) -> Result<()> {
Review Comment:
We do not support copying a directory in `copy`. Therefore, we need to ensure that the input path is not a directory.
##########
core/examples/object.rs:
##########
@@ -31,7 +31,8 @@ async fn main() -> Result<()> {
.try_init();
// Pick a builder and configure it.
- let builder = services::Memory::default();
+ let mut builder = services::Fs::default();
Review Comment:
Avoid using `fs` as an example, as it may cause unexpected changes in the user's environment.
--
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