GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Updates to Paging surface by michaelbausor · Pull Request #255 · googleapis/gax-java

This repository was archived by the owner on Sep 26, 2023. It is now read-only.

Conversation

@michaelbausor

@michaelbausor michaelbausor commented Mar 28, 2017

Copy link
Copy Markdown
Contributor

Updates to paging that correspond to googleapis/gapic-generator#1139

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
michaelbausor added 4 commits March 28, 2017 16:43
@michaelbausor
Remove parameters from Page interface
cd4d721
@michaelbausor
Update surface of Page, PagedListResponse and FixedSizeCollection
220ef77
@michaelbausor
Update paging
105c905
@michaelbausor
Update next page token to string
b078e7f
@michaelbausor
michaelbausor requested a review from garrettjonesgoogle March 28, 2017 23:50
@michaelbausor michaelbausor mentioned this pull request Mar 28, 2017
WIP: updates to Page in core googleapis/google-cloud-java#1821
Closed
@codecov-io

codecov-io commented Mar 28, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

Merging #255 into master will increase coverage by 0.26%.
The diff coverage is 68.35%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #255      +/-   ##
============================================
+ Coverage     70.89%   71.16%   +0.26%     
- Complexity      541      554      +13     
============================================
  Files            78       80       +2     
  Lines          2680     2736      +56     
  Branches        268      275       +7     
============================================
+ Hits           1900     1947      +47     
- Misses          676      683       +7     
- Partials        104      106       +2
Impacted Files Coverage Δ Complexity Δ
...ava/com/google/longrunning/OperationsSettings.java 74.52% <ø> (+1.63%) 7 <0> (ø) ⬇️
.../java/com/google/longrunning/OperationsClient.java 92.85% <ø> (ø) 17 <0> (ø) ⬇️
...main/java/com/google/api/gax/grpc/PageContext.java 100% <100%> (ø) 3 <3> (?)
...in/java/com/google/api/gax/grpc/PagedCallable.java 87.5% <100%> (-1.39%) 2 <1> (ø)
...google/api/gax/grpc/AbstractPagedListResponse.java 22.22% <22.22%> (ø) 4 <4> (?)
...ogle/api/gax/grpc/AbstractFixedSizeCollection.java 75% <75%> (ø) 10 <10> (?)
...ain/java/com/google/api/gax/grpc/AbstractPage.java 84.78% <84.78%> (ø) 16 <16> (?)
.../com/google/longrunning/PagedResponseWrappers.java 83.33% <88.23%> (+33.33%) 0 <0> (ø) ⬇️
...n/java/com/google/api/gax/grpc/BatcherFactory.java 79.66% <0%> (ø) 10% <0%> (ø) ⬇️
...m/google/api/gax/grpc/DirectStreamingCallable.java 9.52% <0%> (ø) 1% <0%> (ø) ⬇️
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d786ed2...9fbc143. Read the comment docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

michaelbausor
michaelbausor commented Mar 29, 2017
View reviewed changes
Comment thread src/main/java/com/google/api/gax/core/Page.java Outdated
* API request and response objects.
*/
public interface Page<RequestT, ResponseT, ResourceT> extends Iterable<ResourceT> {
public interface Page<ResourceT> extends Iterable<ResourceT> {

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@michaelbausor
Convert iterator to iterable
bc4355e
garrettjonesgoogle
garrettjonesgoogle reviewed Mar 29, 2017
View reviewed changes
Comment thread src/test/java/com/google/longrunning/OperationsClientTest.java
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INTERNAL.getCode(), e.getStatusCode());
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@michaelbausor
Merge branch 'master' into page-deparametrize
b6f5e80
garrettjonesgoogle
garrettjonesgoogle reviewed Mar 29, 2017
View reviewed changes
Comment thread src/main/java/com/google/api/gax/core/FixedSizeCollection.java Outdated
*/
package com.google.api.gax.core;

import java.util.Iterator;

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/api/gax/grpc/FixedSizeCollectionImpl.java Outdated
}
private final Iterator<PageContext<?, ?, ResourceT>> pageIterator = pageList.iterator();
private Iterator<ResourceT> resourceIterator =
pageIterator.next().getResourceIterable().iterator();

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/api/gax/grpc/PageContext.java Outdated
@@ -0,0 +1,164 @@
/*
* Copyright 2016, Google Inc. All rights reserved.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/api/gax/grpc/PageContext.java Outdated

// Make the API call eagerly
this.response =
ApiExceptions.callAndTranslateApiException(callable.futureCall(request, context));

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/api/gax/grpc/PagedListResponseContext.java Outdated
private PagedListDescriptor<RequestT, ResponseT, ResourceT> pageDescriptor;
private Page<RequestT, ResponseT, ResourceT> currentPage;
public class PagedListResponseContext<RequestT, ResponseT, ResourceT>
extends PageContext<RequestT, ResponseT, ResourceT> {

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/com/google/api/gax/grpc/UnaryCallableTest.java

public ListIntegersPage(PageContext<Integer, List<Integer>, Integer> context) {
this.context = context;
}

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/com/google/api/gax/grpc/UnaryCallableTest.java Outdated
CallContext callContext) {
this.context = new PagedListResponseContext<>(callable, pageDescriptor, request, callContext);
this.page = new ListIntegersPage(this.context);
}

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

michaelbausor added 3 commits March 30, 2017 09:18
@michaelbausor
Restore request/context ordering
2dd843f
@michaelbausor
Switch to abstract classes
d660529
@michaelbausor
Switch to abstract classes
022fa19
garrettjonesgoogle
garrettjonesgoogle reviewed Apr 4, 2017
View reviewed changes
Comment thread src/main/java/com/google/api/gax/grpc/AbstractPage.java Outdated
return Iterables.size(getResourceIterable());
}
@Override
public abstract AbstractPage<RequestT, ResponseT, ResourceT> getNextPage();

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/api/gax/grpc/AbstractPage.java Outdated

private class AllResourcesIterator extends AbstractIterator<ResourceT> {
AbstractPage<RequestT, ResponseT, ResourceT> currentPage = AbstractPage.this;
Iterator<ResourceT> currentIterator = currentPage.getValues().iterator();

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/longrunning/PagedResponseWrappers.java Outdated
this.context = new PagedListResponseContext<>(callable, pageDescriptor, request, callContext);
this.page = new ListOperationsPage(this.context);
return new ListOperationsPagedResponse(
ListOperationsPage.callApiAndCreate(callable, pageDescriptor, request, callContext));

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/longrunning/OperationsSettings.java Outdated
ListOperationsRequest request,
CallContext context) {
return new ListOperationsPagedResponse(
return ListOperationsPagedResponse.callApiAndCreate(

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/api/gax/grpc/AbstractPage.java Outdated
protected <PageT> PageT getNextPage(PageFactory<RequestT, ResponseT, ResourceT, PageT> provider) {
if (hasNextPage()) {
RequestT nextRequest = pageDescriptor.injectToken(request, getNextPageToken());
return callApiAndCreate(provider, callable, pageDescriptor, nextRequest, context);

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

garrettjonesgoogle
garrettjonesgoogle reviewed Apr 4, 2017
View reviewed changes
Comment thread src/main/java/com/google/api/gax/grpc/AbstractPage.java Outdated
RequestT request,
CallContext context,
ResponseT response);
}

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@michaelbausor
Add PageContext
ff7ee0a
garrettjonesgoogle
garrettjonesgoogle reviewed Apr 4, 2017
View reviewed changes
Comment thread src/main/java/com/google/api/gax/grpc/PageContext.java Outdated

public abstract RequestT request();

public abstract CallContext callContext();

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/api/gax/grpc/PagedCallable.java Outdated
public ApiFuture<PagedListResponseT> futureCall(RequestT request, CallContext context) {
PagedListResponseT pagedListResponse =
pagedListResponseFactory.createPagedListResponse(
pagedListResponseFactory.callAndCreateResponse(

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/longrunning/PagedResponseWrappers.java Outdated
}

private Iterable<ListOperationsPage> iteratePages() {
return iterate(PAGE_FACTORY, this);

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

michaelbausor added 2 commits April 7, 2017 10:45
@michaelbausor
Restructure abstract pages
04068ab
@michaelbausor
Restructure slightly
01deb23
garrettjonesgoogle
garrettjonesgoogle reviewed Apr 7, 2017
View reviewed changes
Comment thread src/main/java/com/google/api/gax/core/AsyncPage.java Outdated
@@ -0,0 +1,35 @@
/*
* Copyright 2016, Google Inc. All rights reserved.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/api/gax/core/PagedListResponse.java Outdated
/** Returns the current page of results. Note: This method is not thread-safe. */
Iterable<Page<RequestT, ResponseT, ResourceT>> iteratePages();
/**
* Return an iterator over all Page objects. Page objects are retrieved lazily via API calls until

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/api/gax/grpc/AbstractFixedSizeCollection.java
import java.util.Iterator;
import java.util.List;

public abstract class AbstractFixedSizeCollection<

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/api/gax/grpc/AbstractFixedSizeCollection.java Outdated
implements FixedSizeCollection<ResourceT> {

private List<PageT> pageList;
private int collectionSize;

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/api/gax/grpc/AbstractPage.java
} else {
return null;
}
}

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/api/gax/grpc/AbstractPage.java Outdated
RequestT nextRequest =
context.pageDescriptor().injectToken(context.request(), getNextPageToken());
final PageContext<RequestT, ResponseT, ResourceT> newContext =
context.withRequest(nextRequest);

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/api/gax/grpc/PageContext.java Outdated

public abstract RequestT request();

public abstract CallContext callContext();

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/longrunning/OperationsSettings.java Outdated
PageContext<ListOperationsRequest, ListOperationsResponse, Operation> pageContext =
PageContext.create(callable, LIST_OPERATIONS_PAGE_STR_DESC, request, context);
ListOperationsResponse response =
ApiExceptions.callAndTranslateApiException(callable.futureCall(request, context));

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/com/google/api/gax/grpc/UnaryCallableTest.java

public static ListIntegersPagedResponse create(
PageContext<Integer, List<Integer>, Integer> context, List<Integer> response) {
ListIntegersPage page = new ListIntegersPage(context, response);

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/com/google/api/gax/grpc/UnaryCallableTest.java Outdated
}

private static ListIntegersSizedPage createEmptyCollection() {
return new ListIntegersSizedPage();

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

michaelbausor added 2 commits April 10, 2017 11:44
@michaelbausor
Fix async and next page calling
4e2593e
Address PR comments
@michaelbausor
Remove unnecessary constructor
a1370e6
garrettjonesgoogle
garrettjonesgoogle reviewed Apr 10, 2017
View reviewed changes

@garrettjonesgoogle garrettjonesgoogle left a comment

Copy link
Copy Markdown
Contributor

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 - just a couple last things which you can address as you see fit.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/main/java/com/google/api/gax/grpc/AbstractFixedSizeCollection.java Outdated
import java.util.List;

/**
* Partial implementation of {@see FixedSizeCollection}.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/api/gax/grpc/AbstractPage.java Outdated
}

public PageT getNextPage(int pageSize) {
public PageT getNextPageImpl(Integer pageSize) {

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

michaelbausor added 2 commits April 10, 2017 14:15
@michaelbausor
Address PR comments
d6be253
@michaelbausor
Remove unused import
9fbc143
@michaelbausor michaelbausor changed the title WIP: Updates to Paging surface Updates to Paging surface Apr 11, 2017
@michaelbausor
michaelbausor merged commit 4791ec9 into googleapis:master Apr 11, 2017
@michaelbausor
michaelbausor deleted the page-deparametrize branch April 11, 2017 20:08
@michaelbausor michaelbausor mentioned this pull request Apr 12, 2017
PageAccessor: support getNextPageAsync() #74
Closed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

2 more reviewers
@lesv lesv lesv left review comments
@garrettjonesgoogle garrettjonesgoogle garrettjonesgoogle left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@michaelbausor @codecov-io @lesv @garrettjonesgoogle
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.