-
Notifications
You must be signed in to change notification settings - Fork 0
feat(storage): Set CRC32C as the default checksum option #7
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
base: main
Are you sure you want to change the base?
Conversation
|
/gemini review |
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.
Code Review
This pull request aims to improve data integrity by setting CRC32C as the default checksum for object uploads. The implementation correctly introduces a default, but it appears to use crc32 instead of the intended crc32c. This seems to be a typo that affects both the main logic and the new tests. Correcting this will align the client with Google Cloud Storage best practices and fulfill the goal of the PR.
|
/gemini summary |
Summary of ChangesThis pull request enhances the Storage client by setting a default checksum validation for object uploads. The primary goal is to improve data integrity by ensuring that Highlights
Changelog
Activity
|
This PR introduces a change to the
insertObjectmethod in the Storage client to set CRC32C as the default checksum for all object uploads.Why this change is needed
Previously, if a user didn't explicitly specify a validation option, no checksum was calculated or sent to the server. By defaulting to CRC32C, we can ensure a higher level of data integrity during uploads without requiring an extra configuration step from the user. This aligns the library with best practices for interacting with Google Cloud Storage and provides a better out-of-the-box experience.
Implementation details
The
resolveUploadOptionsmethod was updated to check for the presence of thevalidatekey. If it's missing and the user hasn't provided their own checksum in the metadata,validateis now set tocrc32c.A new test case was added to verify that the library correctly falls back to the default CRC32C validation when no other options are provided.
An "Undefined array key" error in
chooseValidationMethodwas also fixed to ensure it handles cases where thevalidatekey is not present.This change is non-breaking and improves the robustness of the client library.