-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(binding/java): add list & remove_all support #3333
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
bindings/java/src/main/java/org/apache/opendal/args/OpList.java
Outdated
Show resolved
Hide resolved
bindings/java/src/main/java/org/apache/opendal/BlockingOperator.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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( ... );
} |
bindings/java/src/main/java/org/apache/opendal/BlockingOperator.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good. Comments inline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other LGTM from my side.
Merging... Thanks for your excellent work! |
Related: #3169