Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces automatic checksum precomputation for unbuffered resumable uploads by default, while deprecating the manual precompute_checksums method. It also adds a with_checksum_precomputation builder method to allow disabling this feature for faster uploads. The review feedback highlights an inefficiency in the precomputation loop, where checksums are calculated twice redundantly, and suggests refactoring the stream handling to avoid this overhead.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6769 +/- ##
========================================
Coverage 96.97% 96.98%
========================================
Files 325 325
Lines 106409 106666 +257
========================================
+ Hits 103195 103450 +255
- Misses 3214 3216 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…mputation Leverage ChecksummedSource's built-in hashing during the precomputation pass in send_unbuffered_resumable rather than manually hashing chunks in parallel. Add take_checksum() to ChecksummedSource to finalize and reset the hasher back to None, ensuring subsequent streaming during upload does not perform redundant on-the-fly checksumming.
…state reset into final_checksum and reset_checksum Replace take_checksum with an explicit reset_checksum method on ChecksummedSource, allowing callers to inspect the calculated checksum via final_checksum and explicitly reset the internal hasher state when finished.
…t steps Organize the precomputation block in send_unbuffered_resumable into 3 distinct logical sections: (1) precomputation of checksum, (2) update checksum in resource metadata, and (3) clean up and reset work.
…mputation memoization on retry
This PR enables automatic checksum precomputation for unbuffered resumable uploads and updates the public API to give callers explicit control over this behavior.
Part of #6461
Key Public API Changes
WriteObject::precompute_checksums(): Deprecated because checksums are now automatically computed and validated by default across all upload modes.WriteObject::with_checksum_precomputation(bool): Added with a default value oftrue. Callers performing unbuffered resumable uploads can passfalseto opt out and prioritize upload latency over upfront checksum validation.Implementation Details
google-cloud-storageversion to1.19.0acrossCargo.toml,librarian.yaml, andREADME.md.