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

Added support to specify block size in BlobInputStream #15496

Merged
merged 4 commits into from
Sep 23, 2020

Conversation

gapra-msft
Copy link
Member

Resolves #14739

@ghost ghost added the Storage Storage Service (Queues, Blobs, Files) label Sep 22, 2020
@gapra-msft gapra-msft changed the title Storage/input stream block size Added support to specify block size in BlobInputStream Sep 22, 2020
@gapra-msft gapra-msft added the APIChange This PR contains an addition or change to the API signature and must be reviewed by an architect. label Sep 23, 2020
@gapra-msft
Copy link
Member Author

@alzimmermsft Could you take a look at this PR for API feedback?

BlobRange range = options.getRange() == null ? new BlobRange(0) : options.getRange();
int chunkSize = options.getBlockSize() == null ? 4 * Constants.MB : options.getBlockSize();

return new BlobInputStream(client, range.getOffset(), range.getCount(), chunkSize,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is a minor change where we will make an additional service call to get the properties of the blob before opening the stream. Are we okay with that? If so, we should add a quick document stating that we will be doing this as it is a behavioral change from the past.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I think we already called getProperties before, I just moved it outside since we can't call it in the constructor before a call to super

/**
* @return The size of each data chunk returned from the service. If block size is large, input stream will make
* fewer network calls, but each individual call will send more data and will therefore take longer.
* The default value is 4 MB.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are going to say the default if 4 MB should the getter check for blockSize == null and return 4 * Constants.MB?

return (blockSize == null) ? 4 * Constants.MB : blockSize;

If this change is made, we could also change the return type to int instead of Integer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we tie this type to promising that? I'm a little hesitant to do that. I'd prefer it just be normal fluent behavior

@gapra-msft gapra-msft merged commit f6d8eb2 into Azure:master Sep 23, 2020
@gapra-msft gapra-msft deleted the storage/inputStreamBlockSize branch September 23, 2020 22:50
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-java that referenced this pull request Dec 13, 2021
[DO NOT MERGE]Dev resourcemover microsoft.migrate 2021 08 01 (Azure#15496)

* Adds base for updating Microsoft.Migrate from version stable/2021-01-01 to version 2021-08-01

* Updates readme

* Updates API version in new specs and examples

* Added systemData property in Move Collection & Move Resource object

* Update resourcemovercollection.json

Added Tags and User-Managed Identities Properties

* Update resourcemovercollection.json

Made changes for removing tags property for document resources and resource group.

* Removed additional empty line

* Swagger PrettierCheck

* Updating examples for 2021-08-01 version.

* CI Fix

Co-authored-by: Anany Shah <anashah@microsoft.com>
Co-authored-by: yashjain4 <87814230+yashjain4@users.noreply.github.com>
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-java that referenced this pull request Jan 5, 2022
[DO NOT MERGE]Dev resourcemover microsoft.migrate 2021 08 01 (Azure#15496)

* Adds base for updating Microsoft.Migrate from version stable/2021-01-01 to version 2021-08-01

* Updates readme

* Updates API version in new specs and examples

* Added systemData property in Move Collection & Move Resource object

* Update resourcemovercollection.json

Added Tags and User-Managed Identities Properties

* Update resourcemovercollection.json

Made changes for removing tags property for document resources and resource group.

* Removed additional empty line

* Swagger PrettierCheck

* Updating examples for 2021-08-01 version.

* CI Fix

Co-authored-by: Anany Shah <anashah@microsoft.com>
Co-authored-by: yashjain4 <87814230+yashjain4@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APIChange This PR contains an addition or change to the API signature and must be reviewed by an architect. Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Req] Allow configuring block size for BlobInputStream
3 participants