Skip to content
This repository was archived by the owner on Mar 3, 2026. It is now read-only.

feat: add functionality for passing preconditions at the function level#1993

Merged
shaffeeullah merged 70 commits intomainfrom
shaffeeullah/preconditionUpdates
Aug 10, 2022
Merged

feat: add functionality for passing preconditions at the function level#1993
shaffeeullah merged 70 commits intomainfrom
shaffeeullah/preconditionUpdates

Conversation

@shaffeeullah
Copy link
Copy Markdown
Contributor

@shaffeeullah shaffeeullah commented Jun 27, 2022

Adds functionality to pass preconditions at the function level. Also includes a few fixes such as:

  • ensuring non-idempotent functions don't retry
  • applying preconditions to the correct object if there are two objects involved
    Internal ticket: b/239141167

@product-auto-label product-auto-label Bot added size: l Pull request size is large. api: storage Issues related to the googleapis/nodejs-storage API. labels Jun 27, 2022
@shaffeeullah shaffeeullah added do not merge Indicates a pull request not ready for merge, due to either quality or timing. and removed api: storage Issues related to the googleapis/nodejs-storage API. labels Jun 27, 2022
@product-auto-label product-auto-label Bot added the api: storage Issues related to the googleapis/nodejs-storage API. label Jun 28, 2022
@shaffeeullah shaffeeullah requested a review from frankyn August 5, 2022 16:29
@shaffeeullah shaffeeullah added owlbot:run Add this label to trigger the Owlbot post processor. and removed do not merge Indicates a pull request not ready for merge, due to either quality or timing. labels Aug 5, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Aug 5, 2022
@shaffeeullah shaffeeullah added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 5, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 5, 2022
Copy link
Copy Markdown
Contributor

@danielbankhead danielbankhead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just 2 things

Comment thread src/storage.ts
}

if (typeof err.code === 'string') {
const reason = (err.code as string).toLowerCase();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cast here shouldn’t be necessary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without this line it throws errors: Property 'toLowerCase' does not exist on type 'never'.

Comment thread test/bucket.ts Outdated
Copy link
Copy Markdown
Contributor

@frankyn frankyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two comments, IIUC you're extending existing options with PreconditionOptions for all operations.

Comment thread src/iam.ts Outdated
Comment thread src/iam.ts Outdated
ddelgrosso1 and others added 4 commits August 5, 2022 13:54
…#2020)

* tests: remove callback waterfall from make bucket private system test

* cleaner implementation
…pis/nodejs-storage into shaffeeullah/preconditionUpdates
@shaffeeullah shaffeeullah added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 8, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 8, 2022
@shaffeeullah
Copy link
Copy Markdown
Contributor Author

@frankyn can you please take another look at this when you have a sec?

Copy link
Copy Markdown
Contributor

@frankyn frankyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had one more question, otherwise LGTM.

Comment thread src/nodejs-common/util.ts

if (typeof reqOpts.maxRetries === 'number') {
options.retries = reqOpts.maxRetries;
options.noResponseRetries = reqOpts.maxRetries;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naive question, shouldn't this value come from maxRetryValue instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reqOpts.maxRetries overrides maxRetryValue. It's used in cases where we need to override the user (like forcing no retries because of idempotency)

@shaffeeullah shaffeeullah requested a review from frankyn August 10, 2022 00:09
@shaffeeullah shaffeeullah merged commit 21f173e into main Aug 10, 2022
@shaffeeullah shaffeeullah deleted the shaffeeullah/preconditionUpdates branch August 10, 2022 14:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: storage Issues related to the googleapis/nodejs-storage API. size: xl Pull request size is extra large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants