Xuanwo commented on code in PR #4883:
URL: https://github.com/apache/opendal/pull/4883#discussion_r1675401172


##########
core/src/layers/blocking.rs:
##########
@@ -178,10 +180,10 @@ impl<A: Access> LayeredAccess for BlockingAccessor<A> {
         &self.inner
     }
 
-    fn metadata(&self) -> AccessorInfo {
-        let mut meta = self.inner.info();
+    fn metadata(&self) -> Arc<AccessorInfo> {
+        let mut meta = (*self.inner.info()).clone();

Review Comment:
   We can use `clone_from` to make the code a bit more readable:
   
   ```rust
   let mut meta = AccessorInfo::default();
   meta.clone_from(&self.inner.info());
   ...
   ```
   
   Or
   
   ```rust
   let mut meta = self.inner.info().as_ref().clone();
   ```



##########
core/src/layers/complete.rs:
##########
@@ -380,13 +380,14 @@ impl<A: Access> LayeredAccess for CompleteAccessor<A> {
         &self.inner
     }
 
-    fn metadata(&self) -> AccessorInfo {
-        let mut meta = self.meta.clone();
+    // Todo: May move the logic to the implement of Layer::layer of 
CompleteAccessor<A>

Review Comment:
   Nice idea, we can create an issue for this.



##########
core/src/types/operator/operator.rs:
##########
@@ -64,6 +66,8 @@ use crate::*;
 pub struct Operator {
     // accessor is what Operator delegates for
     accessor: Accessor,
+    // info stores the metadata for operator, users can use this metadata to 
get information of operator.
+    info: OnceCell<Arc<OperatorInfo>>,

Review Comment:
   Hi, I think we no longer need to store `OperatorInfo` in the operator since 
building `OperatorInfo` is now cost-effective.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to