Xuanwo commented on issue #5425:
URL: https://github.com/apache/opendal/issues/5425#issuecomment-2781462998

   I'm thinking about this for a while. One possible idea is we can store an 
`LazyCell` in `Reader` which can only be filled once users start a real read. 
   
   There are two possible API design:
   
   ```rust
   impl Reader {
       fn metadata(&self) -> Option<&Metadata>;
       async fn metadata(&self) -> &Metadata;
   }
   ```
   
   for `fn metadata(&self) -> Option<&Metadata>`:
   
   Reader always return `None` if we don't know about it, otherwise returns 
`Some(&Metadata)`.
   
   This one is super clear but might be a bit not useful.
   
   for `async fn metadata(&self) -> &Metadata`:
   
   Reader can start a `stat` call internally if the metadata is not know yet. 
   
   This one is easy to use but have the following two problems:
   
   - Hidden API call happened.
   - `stat` can return error but there is no way to handle it.


-- 
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