-
Notifications
You must be signed in to change notification settings - Fork 374
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
feat: Allow a new upload session to be initiated as a single method call #12054
Conversation
d5d4508
to
a888e06
Compare
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.
I think it would be useful to include the UploadObjectOptions as a parameter to these new methods, and then include the length in the UploadObjectOptions. We'd use the options slightly diferent in these methods, as the length field would be used to create the source (empty) stream instead of to modify the uploader, but I think that's fine, options are still surfaced in a consistent manner. And we would have to fail if both a stream and a lenght are provided, which is also fine I think. It's ugly implementation wise though.
Also, we could update this snippet to be simpler
I'll have a look at how much of UploadObjectOptions would actually be relevant. I thought most of it wouldn't be, but I could be wrong. Will look tomorrow. |
Right, having looked, I can see that UploadObjectOptions does indeed have a bunch of stuff in that would be relevant. I think my personal preference would still be to have a separate method accepting the length and an UploadObjectOptions rather than putting the length into the options directly. I'll amend the PR with my preference for this, and we can then discuss it further. (I may have misunderstood your proposal.) |
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.
Yep, this looks good.
Great - will do all the rest of the work tomorrow, thanks ! |
839dc4e
to
d12a473
Compare
Okay, this is now ready for proper review. It's currently only the async methods. I suspect we could add synchronous methods just by calling I'm happy to either add the sync methods in here, or wait until they're requested. |
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.
Tiny nit only.
I'm fine with adding the sync versions later if there's demand for it.
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param> | ||
/// <param name="options">Additional options for the upload. May be null, in which case appropriate |
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.
super nit: swap these two? I thought Visual Studio would catch that.
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.
Whoops, yes, will do.
This allows the content length to be (optionally) specified, which is then propagated via X-Upload-Content-Length.
d12a473
to
b8bf052
Compare
This allows the content length to be (optionally) specified, which is then propagated via X-Upload-Content-Length.
This is currently just a prototype for comment - I'd want to add integration tests, some unit tests, and obviously XML docs.
See #12034 for background.