refactor(core): move move logic from fn metadata(&self) -> Arc<AccessorInfo> to impl<A: Access> Layer<A> for CompleteLayer#4896
refactor(core): move move logic from fn metadata(&self) -> Arc<AccessorInfo> to impl<A: Access> Layer<A> for CompleteLayer#4896Lzzzzzt wants to merge 5 commits intoapache:mainfrom
Conversation
core/src/layers/complete.rs
Outdated
| 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.
Maybe we can remove those code and the comment?
There was a problem hiding this comment.
if we do this, the issue #4888 is not resolved....
There was a problem hiding this comment.
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.
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.
Yep, since we have created the Arc<AccessInfo> during layer(), we can remove the dup code here.
There was a problem hiding this comment.
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 |
|
Should be fixed by #5662 |
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