feat: add additional layers support#7128
Conversation
This commit adds support for additional layers to the Java bindings: - MimeGuessLayer: automatically set Content-Type based on file extension - TimeoutLayer: add timeout for operations - LoggingLayer: add structured logging for operations - HotpathLayer: add hotpath profiling for operations These layers were already supported in Python and Node.js bindings but were missing in Java, causing API inconsistency across language bindings. Closes apache#6738
This commit fixes Java code formatting issues detected by spotless.
|
for toml format , u can use |
753383a to
05fddba
Compare
| /** | ||
| * This layer adds structured logging for every operation. | ||
| * | ||
| * <p>Note: This layer requires proper logging setup (e.g., log4j2, java.util.logging) to work. |
There was a problem hiding this comment.
Hi, please understand your changes first. LoggingLayer integrate rust's log crate and thus requires we to provide a set_logger call. Users can't configure that through log4j2 or java.util.logging.
Maybe we can start a discussion thread on how we do that.
There was a problem hiding this comment.
Sorry for rough pr.
Honestly I'm not that familiar with this binding layer, and just think this can be implemented with ai just because it has other language implementation as reference.
I'll do some research to understand what the binding layer is for and then do discussion about implementation.
Thanks for kindly review.
There was a problem hiding this comment.
Hi, please understand your changes first.
LoggingLayerintegrate rust'slogcrate and thus requires we to provide aset_loggercall. Users can't configure that throughlog4j2orjava.util.logging.Maybe we can start a discussion thread on how we do that.
I have been studying the abstraction role of the OpenDAL layer and now understand the issues with the Java LoggingLayer implementation in my previous PR.
I would like to ask:
- Is it okay if I temporarily abandon the implementation of the LoggingLayer part for now?
- Alternatively, should I pursue a deeper integration with SLF4J, Log4j, or java.util.logging instead?
Summary
This PR adds support for additional layers to the Java bindings to align with Python and Node.js bindings.
Added Layers
Changes
bindings/java/src/main/java/org/apache/opendal/layer/bindings/java/src/layer.rsbindings/java/Cargo.tomlto enable required featuresbindings/java/src/test/java/org/apache/opendal/test/LayerTest.javaTesting
All 7 layer tests pass:
testOperatorWithRetryLayertestOperatorWithConcurrentLimitLayertestOperatorWithMimeGuessLayertestOperatorWithTimeoutLayertestOperatorWithLoggingLayertestOperatorWithThrottleLayertestOperatorWithHotpathLayerIssue
Closes #6738