apache / opendal

Apache OpenDAL: access data freely.
https://opendal.apache.org
Apache License 2.0
3.27k stars 456 forks source link

Support extend layers for Java binding #3367

Closed tisonkun closed 11 months ago

tisonkun commented 11 months ago
Xuanwo commented 11 months ago

Recently, I've been considering the concept of layers in bindings. I previously believed that all bindings should have their own unique layer abstractions and implementations. However, I discovered that it's illogical for each binding to implement the same layer individually. This contradicts our OpenDAL's VISON.

Looking back at the Java binding, perhaps the main issue lies in how we've designed the API to expose Rust layers in Java. We could consider exposing them as org.apache.opendal.layers.RetryLayer, and construct a similar API like op.layer(new RetryLayer()).

tisonkun commented 11 months ago

@Xuanwo the layer implemented in Java API should include a way to export Rust's layers, while it's not conflict with making a pure Java layer to leverage Java ecosystem. The first challenge I meet is how to pipeline the accessor and adapt operator class into this absraction :D

Xuanwo commented 11 months ago

The first challenge I meet is how to pipeline the accessor and adapt operator class into this absraction :D

I strongly oppose exposing Accessor to the bindings realm. It's OpenDAL's raw API, which users should never interact with. Technically, it's challenging for Java to access generic types in Rust through FFI.