Skip to content
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

cleanup(storage): simplify ObjectReadStreambuf #6983

Merged

Conversation

coryan
Copy link
Contributor

@coryan coryan commented Jul 14, 2021

Simplify the implementation of storage::internal::ObjectReadStreambuf.
The class had two different paths to get more data from the underlying
internal::ObjectReadSource, this change makes all reads through the
xsgetn() function.

In addition, the class was sloppy with the hash validator, potentially
using it after it was moved-from, luckily this was harmless, but no
reason to keep doing so.

I added some integration tests to cover corner cases that were only
detected by accident in other tests.

Part of the work for #4156 and #4157


This change is Reviewable

Simplify the implementation of `storage::internal::ObjectReadStreambuf`.
The class had two different paths to get more data from the underlying
`internal::ObjectReadSource`, this change makes all reads through the
`xsgetn()` function.

In addition, the class was sloppy with the hash validator, potentially
using it after it was moved-from, luckily this was harmless, but no
reason to keep doing so.

I added some integration tests to cover corner cases that were only
detected by accident in other tests.
@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Jul 14, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Jul 14, 2021
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 14, 2021
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: ab6e58ea2f8cef0595fc848f1062307d7b405a45

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@codecov
Copy link

codecov bot commented Jul 14, 2021

Codecov Report

Merging #6983 (65f9f05) into main (24559cb) will increase coverage by 0.00%.
The diff coverage is 98.92%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #6983   +/-   ##
=======================================
  Coverage   94.56%   94.57%           
=======================================
  Files        1298     1298           
  Lines      114599   114608    +9     
=======================================
+ Hits       108371   108385   +14     
+ Misses       6228     6223    -5     
Impacted Files Coverage Δ
...gle/cloud/storage/internal/object_read_streambuf.h 100.00% <ø> (ø)
...le/cloud/storage/internal/object_read_streambuf.cc 97.75% <97.95%> (+2.92%) ⬆️
...ud/storage/examples/storage_client_mock_samples.cc 100.00% <100.00%> (ø)
google/cloud/storage/internal/hash_validator.h 84.61% <100.00%> (+4.61%) ⬆️
...loud/storage/tests/small_reads_integration_test.cc 100.00% <100.00%> (ø)
google/cloud/pubsub/samples/samples.cc 91.67% <0.00%> (-0.08%) ⬇️
.../cloud/storage/benchmarks/throughput_experiment.cc 74.87% <0.00%> (+0.50%) ⬆️
google/cloud/bigtable/internal/common_client.cc 97.14% <0.00%> (+1.42%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 24559cb...65f9f05. Read the comment docs.

@coryan coryan marked this pull request as ready for review July 14, 2021 10:15
@coryan coryan requested a review from a team as a code owner July 14, 2021 10:15
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 65f9f0513b12745824df02fa10ce843c970a56af

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@coryan coryan merged commit ca2208c into googleapis:main Jul 14, 2021
@coryan coryan deleted the cleanup-storage-simplify-object-read-streambuf branch July 14, 2021 14:07
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 Cloud Storage API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants