-
Notifications
You must be signed in to change notification settings - Fork 77
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
add disableGzipContent option for create from InputStream #82
add disableGzipContent option for create from InputStream #82
Conversation
375fdb3
to
d0ef86f
Compare
Codecov Report
@@ Coverage Diff @@
## master #82 +/- ##
============================================
+ Coverage 63.3% 63.32% +0.01%
Complexity 528 528
============================================
Files 30 30
Lines 4720 4722 +2
Branches 450 450
============================================
+ Hits 2988 2990 +2
Misses 1571 1571
Partials 161 161
Continue to review full report at Codecov.
|
…s#36) Previously, only the methods to create blobs that take a byte[] argument offer the option to disable gzip compression; the methods that accept an InputStream argument do not. This is due to the BlobWriteOption enum missing a matching constant for BlobTargetOption.IF_DISABLE_GZIP_CONTENT. This change set adds a matching IF_DISABLE_GZIP_CONTENT constant to BlobWriteOption including the correct translation to StorageRpc.Option. The net result is that the Storage create functions that accept an InputStream now offer the option to disable gzip compression.
b84e5db
to
183d0c6
Compare
Hi there! I'm curious if you have any feedback or questions on the idea and the approach? Thanks in advance! |
Change LGTM, pending tests to finish and will merge. Thank you for your contribution @nblair! |
Thanks for your time @frankyn - cheers! |
Is your feature request related to a problem? Please describe.
I have a use case that necessitates using the Storage/Bucket write method variants with InputStream arguments. The inputs for my use case to store in Cloud Storage are:
Describe the solution you'd like
Given that our content is already compressed, I would prefer to avoid spending the CPU time on compressing the content again en route to the Bucket.
Describe alternatives you've considered
We have used the
byte[]
variants, withBlobTargetOption.disableGzipContent
and the Compose request. This is suitable but leaves us with a tuning challenge:byte[]
chunks) requires additional heap space be available32 * bufferSize
, we will upload 31 small sized chunks and 1 large chunk that we have to use theInputStream
variant for anyways, and pay the additional overhead of gzip compression.Additional context
I have done some exploration and it appears that the values on the BlobWriteOption (used on
InputStream
variants) and BlobTargetOption (used onbyte[]
variants) enums both are translated intoStorageRpc.Option
. I have a small contribution to offer in the form of a pull request to follow.Fixes #36; ported from googleapis/google-cloud-java#7057