KEMBAR78
chore: cleanup Crc32cValue and associated Hasher operations by BenWhitehead · Pull Request #3167 · googleapis/java-storage · GitHub
Skip to content

Conversation

@BenWhitehead
Copy link
Collaborator

@BenWhitehead BenWhitehead commented Jun 24, 2025

  • Add Crc32cValue#zero()
    • Crc32cValue.zero().concat(v) == v
  • Add temporary WriteCtx constructor that allows specifying the initial crc32c value
    • The desired default will be Crc32cValue.zero(), but not all tests or uploads are ready to handle this. Stick with the existing null as default, and provide the overload to selectively opt into things incrementally.
  • Update Hasher.nullSafeConcat to account for the use of zero
    • if Hasher.noop() always return null
    • if Hasher.enabled() only return null if left side is null
  • Add nullability annotation to Crc32cValue.nullSafeConcat

@BenWhitehead BenWhitehead requested a review from a team as a code owner June 24, 2025 19:59
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: storage Issues related to the googleapis/java-storage API. labels Jun 24, 2025
@BenWhitehead BenWhitehead force-pushed the checksumming/02/crc32c-value-cleanup branch from 79c220f to dbf4604 Compare June 24, 2025 20:12
* Add `Crc32cValue#zero()`
  * `Crc32cValue.zero().concat(v) == v`
* Update WriteCtx to use `Crc32cValue.zero()` as it's base values rather than `null`
* Update Hasher.nullSafeConcat to account for the use of `zero`
  * if Hasher.noop() always return null
  * if Hasher.enabled() only return null if left side is null
* Add nullability annotation to Crc32cValue.nullSafeConcat
…initial crc32c value

The desired default will be `Crc32cValue.zero()`, but not all tests or uploads are ready to handle this. Stick with the existing null as default, and provide the overload to selectively opt into things incrementally.
@BenWhitehead BenWhitehead force-pushed the checksumming/02/crc32c-value-cleanup branch from 454cf4b to f97befb Compare June 25, 2025 22:36
@BenWhitehead BenWhitehead added this to the e2e-crc32c-media milestone Jun 30, 2025
Copy link
Contributor

@cojenco cojenco left a comment

Choose a reason for hiding this comment

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

LGTM, had a GVC review session with Ben

/**
* TODO: Remove initialValue and replace with Crc32cValue.zero() once all uploads have been
* updated to do e2e checksumming by default.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Discussed in GVC; this is later updated in #3176

BenWhitehead added a commit that referenced this pull request Jul 23, 2025
Merge train for

* chore: cleanup Crc32cValue and associated Hasher operations #3167
* chore: add Hasher#defaultHasher() #3173
* chore: add UnifiedOpts.Opts#getHasher() to return a hasher relative to the set of Opts defined for an operation. #3174
* feat: add default end-to-end crc32c checksumming for several upload methods via grpc transport #3176
* feat: add default end-to-end checksumming for JournalingBlobWriteSessionConfig #3180
* fix: give user provided checksum precondition priority for Storage#create methods that accept byte[] #3182
* fix: move crc32c computation before writing to disk for BufferToDiskThenUpload BlobWriteSession config #3187
@BenWhitehead
Copy link
Collaborator Author

merged in #3197

@BenWhitehead BenWhitehead deleted the checksumming/02/crc32c-value-cleanup branch July 23, 2025 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the googleapis/java-storage API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants