-
Notifications
You must be signed in to change notification settings - Fork 472
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
refactor(core): move move logic from fn metadata(&self) -> Arc<AccessorInfo> to impl<A: Access> Layer<A> for CompleteLayer #4896
base: main
Are you sure you want to change the base?
Conversation
core/src/layers/complete.rs
Outdated
@@ -382,7 +389,7 @@ impl<A: Access> LayeredAccess for CompleteAccessor<A> { | |||
|
|||
// Todo: May move the logic to the implement of Layer::layer of CompleteAccessor<A> | |||
fn metadata(&self) -> Arc<AccessorInfo> { | |||
let mut meta = (*self.meta).clone(); | |||
let mut meta = self.meta.as_ref().clone(); | |||
let cap = meta.full_capability_mut(); | |||
if cap.list && cap.write_can_empty { |
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 we can remove those code and the comment?
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.
if we do this, the issue #4888 is not resolved....
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.
if we do this, the issue #4888 is not resolved....
Could you elaborate further? I'm not sure which issue remains unresolved.
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 we can remove those code and the comment?
you means delete the
// Todo: May move the logic to the implement of Layer::layer of CompleteAccessor<A>
and
let mut meta = self.meta.as_ref().clone();
?
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.
Yep, since we have created the Arc<AccessInfo>
during layer()
, we can remove the dup code here.
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.
that's my problem, sry.
The C/C++ test failed, which is a bit weird. I'll try to figure out what happened. I'm guessing it's related to our |
Signed-off-by: Lzzzt <[email protected]>
Signed-off-by: Lzzzt <[email protected]>
Signed-off-by: Lzzzt <[email protected]>
Signed-off-by: Lzzzt <[email protected]>
Signed-off-by: Lzzzt <[email protected]>
I'm curious about the C binding error in CI, so I debugged it locally. bindings/c/src/tests/bdd.cpp: error = opendal_operator_create_dir(this->p, "tmpdir/"); // <====== the error is not nullptr
EXPECT_EQ(error, nullptr); bindings/c/src/operator.rs #[no_mangle]
pub unsafe extern "C" fn opendal_operator_create_dir(
op: &opendal_operator,
path: *const c_char,
) -> *mut opendal_error {
assert!(!path.is_null());
let path = std::ffi::CStr::from_ptr(path)
.to_str()
.expect("malformed path");
if let Err(err) = op.deref().create_dir(path) {
println!("create dir error: {err}"); // <========
opendal_error::new(err)
} else {
std::ptr::null_mut()
}
} core/src/layers/complete.rs fn complete_blocking_create_dir(&self, path: &str, args: OpCreateDir) -> Result<RpCreateDir> {
let capability = self.info.full_capability();
println!(
"complete_blocking_create_dir: full capability = {:?}",
capability
);
if capability.create_dir && capability.blocking {
println!("complete_blocking_create_dir: create_dir && blocking"); <===== after this PR
return self.inner().blocking_create_dir(path, args);
}
if capability.write_can_empty && capability.list && capability.blocking {
println!("complete_blocking_create_dir: write_can_empty && list && blocking"); <====== before this PR
let (_, mut w) = self.inner.blocking_write(path, OpWrite::default())?;
oio::BlockingWrite::close(&mut w)?;
return Ok(RpCreateDir::default());
}
Err(self.new_unsupported_error(Operation::BlockingCreateDir))
} error: The
|
Which issue does this PR close?
Closes #4888
What changes are included in this PR?
mentioned in #4888
Are there any user-facing changes?
No