-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fixing retries of Storage.create #2359
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
Conversation
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.
LGTM, but maybe mark()/reset() is worth doing it.
Map<StorageRpc.Option, ?> optionsMap = optionMap(targetOptions.x(), targetOptions.y()); | ||
InputStream inputStreamParam = firstNonNull(content, new ByteArrayInputStream(EMPTY_BYTE_ARRAY)); | ||
// retries are not safe when the input is an InputStream, so we can't retry. | ||
return Blob.fromPb(this, storageRpc.create(blobPb, inputStreamParam, optionsMap)); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -1460,6 +1463,7 @@ public static Builder newBuilder() { | |||
* @return a [@code Blob} with complete information | |||
* @throws StorageException upon failure | |||
*/ | |||
@Deprecated |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
So for now we're not supposed to use it and are required to either load everything into RAM or write a lot of boilerplate? |
Ping @garrettjonesgoogle and @andreamlin for user feedback on this PR. Is there a plan to introduce |
I have filed #2620 to track the work of introducing |
Blob create(BlobInfo blobInfo, InputStream content, BlobWriteOption... options)
: Turning off retries and marking@Deprecated
, because once theInputStream
has been consumed, it can't be consumed again.Blob create(BlobInfo blobInfo, byte[] content, BlobTargetOption... options)
: Re-creating theInputStream
on every call, so that the same data is resent to the server.