-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
chore: remove paginator dependency and use gapic to return streams for paginated calls instead #762
Conversation
Codecov Report
@@ Coverage Diff @@
## master #762 +/- ##
=======================================
Coverage 99.13% 99.14%
=======================================
Files 17 17
Lines 15774 15818 +44
Branches 951 959 +8
=======================================
+ Hits 15638 15682 +44
Misses 133 133
Partials 3 3
Continue to review full report at Codecov.
|
@AVaksman I know it's still a draft, so sorry if I'm jumping in too soon. But, I was wondering if you could describe the intentions behind this when you get the chance? Thanks! |
paginator
and use gapic to return streams for paginated calls instead
gapic now supports paginated calls and its streamified versions directly. |
Does it also retry requests? |
Yes, gax supports retries for paged calls. |
src/index.ts
Outdated
@@ -750,16 +750,20 @@ export class Bigtable { | |||
}); | |||
}; | |||
|
|||
const streamified = {listTablesStream: true}; |
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.
Can we use a different variable name to better describe the difference between a method that is "streamified" and one that isn't? Does this list effectively hold GAPIC streaming methods? If so, maybe const gapicStreamingMethods = {...};
?
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.
Done
src/index.ts
Outdated
@@ -805,6 +809,20 @@ export class Bigtable { | |||
.pipe(stream); | |||
}); | |||
} | |||
|
|||
function makeRequestStreamified() { |
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.
Let's rename this, too, to be more clear. Maybe makeGapicStreamRequest()
?
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.
Done
src/instance.ts
Outdated
|
||
// eslint-disable-next-line @typescript-eslint/no-this-alias | ||
const self = this; | ||
const transform = function ( |
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.
Would this work (minus annotations and formatting)?
// name change to indicate purpose of method
const transformToTable = (chunk, enc, next) => { // no "this" argument
const table = this.table(chunk.name); // the Table constructor should support raw input
table.metadata = chunk;
next(null, table);
};
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.
Done!
Have to pass tableId only thought, Table constructor checks for the proper projectId presence.
…lates (googleapis#769) This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/5e903fff-57bb-4395-bb94-8b4d1909dbf6/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: googleapis/synthtool@21f1470 Source-Link: googleapis/synthtool@388e10f
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/5e903fff-57bb-4395-bb94-8b4d1909dbf6/targets - [ ] To automatically regenerate this PR, check this box.
Thanks! |
@stephenplusplus I added another unit test after the approval |
Nice, lgtm! |
gapic supports both paginated calls and its streamified versions.