feat(binding/java): add list & remove_all support#3333
feat(binding/java): add list & remove_all support#3333tisonkun merged 23 commits intoapache:mainfrom G-XD:java_binding_list
Conversation
# Conflicts: # bindings/java/src/blocking_operator.rs # bindings/java/src/test/java/org/apache/opendal/test/behavior/AbstractBehaviorTest.java
|
Let's wait a bit for the refactor PR #3332 and do a rebase. I assume that rebase this PR is simpler than rebase that one (for behavior tests). Sorry to make such conflicts. |
|
Now you can do the rebase and I'll review this PR in about days - I'm a bit busy in today and tomorrow. |
# Conflicts: # bindings/java/src/test/java/org/apache/opendal/test/behavior/AbstractBehaviorTest.java
There was a problem hiding this comment.
I support the changes for:
- remove all
- list without args
Perhaps we can have another round to think of how to pass over args via JNI. But as long as we don't populate a large amount methods in this flavor, I can support to give it a try (as a baseline to improve).
BTW, how to convert list is another issue, you can take a look at this PR for another flavor. I don't have a strong preference for this point but we may align the pattern.
I'm not sure if builder pattern is a good idea in java like: op.list_with()
.limit(5)
.startAfter(someElement)
.join();But anyway, I do agree with @tisonkun's comment that we can merge |
Since the |
|
@G-XD One things to be verified:
Do you check which one is more efficient? I prefer |
I didn't do a performance comparison test, but I think minimize marshalling of resources across the JNI layer is correct. |
|
What's the difference of List and Entry[]? |
op.list_with()
.limit(5)
.startAfter(someElement)
.join();This is exactly what I expected to implement in Java API. Let's investigate it in a following PR. Maybe class Lister {
private final Operator op;
private int limit;
public Lister limit(int limit) {
this.limit = limit;
return this;
}
public CompletableFuture<T> execute() {
return executeNative(op, limit, <other args>);
}
private static native executeNative( ... );
} |
tisonkun
left a comment
There was a problem hiding this comment.
Generally looks good. Comments inline.
|
Merging... Thanks for your excellent work! |
Related: #3169