-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Paged Flux abstractions #6465
Paged Flux abstractions #6465
Conversation
sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java
Outdated
Show resolved
Hide resolved
… the default implementation of paged flux
…as PagedFlux, this will help us from not exposing more-more flux operator on PagedFlux, enable Continuation-option in base abstract type
sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java
Outdated
Show resolved
Hide resolved
@JonathanGiles we talked about identifying the places where Line 259 in d6a8381
|
sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuationState.java
Outdated
Show resolved
Hide resolved
Would this handle only requesting 1 page at a time and not trigger subsequent page requests? #6518 |
…ontinuationState.java Co-Authored-By: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com>
@alzimmermsft Would this handle only requesting 1 page at a time and not trigger subsequent page requests: its configurable in the |
… into paging-base
…edFlux.java Co-Authored-By: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com>
sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePagedFlux.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java
Outdated
Show resolved
Hide resolved
…ersion of azure-core to 1.2.0 (to get new page abstractions)
…torage-batch, azure-core-test to unreleased 1.2.0
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 have a few comments about docs and minor changes. Otherwise, looks great!
*/ | ||
List<T> getItems(); | ||
|
||
public interface Page<T> extends ContinuablePage<String, T> { |
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.
Yes, because we have a released version already, we'll have to keep this hierarchy.
sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java
Outdated
Show resolved
Hide resolved
* This class is a flux that can operate on a {@link PagedResponse} and also provides the ability to operate on | ||
* individual items. When processing the response by page, each response will contain the items in the page as well as | ||
* the request details like status code and headers. | ||
* This type is a Flux provides the ability to operate on paginated REST response of type {@link PagedResponse} |
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.
* This type is a Flux provides the ability to operate on paginated REST response of type {@link PagedResponse} | |
* This type is a {@link Flux} that provides the ability to operate on paginated REST response of type {@link PagedResponse} |
// 2. Add a new ctr "PagedFlux(Supplier<PageRetriever<String, PagedResponse<T>>>)". | ||
// 3. Remove the factory method "PagedFlux::create" and this PRIVATE ctr in favour of #2. | ||
// | ||
private PagedFlux(Supplier<PageRetriever<String, PagedResponse<T>>> provider, boolean ignored) { |
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.
Agree. Maybe this can be tracked in a github issue with appropriate labels so we don't forget to make this change when working on a major version release.
sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponseBase.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java
Outdated
Show resolved
Hide resolved
*/ | ||
List<T> getItems(); | ||
|
||
public interface Page<T> extends ContinuablePage<String, T> { |
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.
@anuchandy Can you please be sure to update #6610 with the final set of changes we would make when a breaking-change release is possible.
default List<T> getItems() { | ||
IterableStream<T> iterableStream = this.getElements(); | ||
return iterableStream == null | ||
? null |
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.
Could we not return an empty IterableStream rather than null here, to be doubly protective of the end user?
sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java
Outdated
Show resolved
Hide resolved
// 2. Add a new ctr "PagedFlux(Supplier<PageRetriever<String, PagedResponse<T>>>)". | ||
// 3. Remove the factory method "PagedFlux::create" and this PRIVATE ctr in favour of #2. | ||
// | ||
private PagedFlux(Supplier<PageRetriever<String, PagedResponse<T>>> provider, boolean ignored) { |
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.
We will unfortunately need to live with this inconsistency until we can do a breaking change release. The only positive is that we don't expect end users to be dealing with this API, so the only people encountering this will be client library developers.
sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java
Outdated
Show resolved
Hide resolved
public List<T> getItems() { | ||
return items; | ||
public IterableStream<T> getElements() { | ||
return items == null |
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 agree with Alan
Co-Authored-By: Jonathan Giles <jonathan@jonathangiles.net>
public List<ConfigurationSetting> getItems() { | ||
return items; | ||
public IterableStream<ConfigurationSetting> getElements() { | ||
return items == null ? IterableStream.empty() : new IterableStream<>(items); |
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.
Could introduce IterableStream.of(List)
or similar to avoid null checks in these cases.
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.
added IterableStream.of(Iterable<T>)
factory method: if parameter to this factory is null
then it return cached static empty stream otherwise it create a new IterableStream
from the parameter.
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.
LGTM. Let's get this into azure-core and have a beta release in February to test it out. @hemanttanwar We don't want the february release to be a GA release of azure core.
@hemanttanwar - Couple of client-lib pom are updated to refer "unreleased version of azure_core" which has pagination improvements. Could you please take a look at those and if all good let's get this in. |
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.
Like we spoke about it, Just run update_version script to make sure there are no more changed needed in pom files.
@hemanttanwar thanks, as discussed I ran the following command on this changes:
and it didn't update any pom files which indicates that the current changes are correct. |
No description provided.