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/03/25 16:24:36 UTC

[GitHub] [incubator-opendal] Xuanwo opened a new issue, #1767: design: Allow implement layer in native way for bindings

Xuanwo opened a new issue, #1767:
URL: https://github.com/apache/incubator-opendal/issues/1767

   To implement a layer in python or nodejs, we should build a `PythonLayer` to `NodejsLayer` first.
   
   Let's take Python as an example. First, we will implement `Layer` for `PythonLayer` and then call the native function inside it. Bindings can provide their own layer interface based on their specific needs. For instance, a Python binding can expose a layer class that includes functions such as `pre_stat`, `post_stat`, `pre_read`, and `post_read`.
   
   So the code will be like:
   
   ```rust
   impl Layer for PythonLayer {
       async fn stat(&self, path: &str, op: OpStat) -> Result<Metadata> {
           call_python(pre_stat(path, &op))
           self.inner.stat()
           call_python(post_stat(path, &op))
       }
   }
   ```


-- 
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.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-opendal] Xuanwo closed issue #1767: design: Allow implement layer in native way for bindings

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo closed issue #1767: design: Allow implement layer in native way for bindings
URL: https://github.com/apache/incubator-opendal/issues/1767


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