forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Azure#334 from rickle-msft/New-Storage-SDK-V10-Pre…
…view-dev New storage sdk v10 preview dev
- Loading branch information
Showing
74 changed files
with
3,653 additions
and
1,246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
XXXX.XX.XX Version XX.X.X-Preview | ||
2018.07.03 Version 10.0.1-Preview | ||
* Created the StorageException type, which deserializes the XML payload in an error response if present and gives access to the ErrorCode header as a property. | ||
* Changed the AppendBlobAccessConditions field types to be Long instead of Int. | ||
* Changed RequestRetryOptions maxTries and tryTimeout fields to be Integer instead of int. 0 is no longer allowed. | ||
* Changed the return type of BlobURL.download to be a DownloadResponse instead of BlobsDownloadResponse for integration with RetryReader. | ||
* Changed CommonRestResponse.lastModifiedTime to be lastModified. | ||
* Changed the dateProperty field in all auto-generated files to be date. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
XXXX.XX.XX Version XX.X.X-Preview | ||
2018.07.03 Version 10.0.1-Preview | ||
* Added the RetryReader class to allow for more reliable streaming on large downloads. This is now the return type of blobURL.download | ||
* Fixed a bug that caused generation of signatures to fail at high levels of parallelism. | ||
* Created the StorageException type to give easy access to the ErrorCode, StatusCode, and Message as available for unsuccessful responses. | ||
* Added the StorageErrorCode type for checking against error codes returned by the service. | ||
* Changed the AppendBlobAccessConditions field types to be Long instead of Int. | ||
* Upgraded Netty dependency to allow uploading memory mapped files with https. | ||
* Upgraded the autorest runtime dependency to fix a dependency bug in their package. | ||
* Changed RequestRetryOptions maxTries and tryTimeout fields to be Integer instead of int. 0 is no longer allowed. | ||
* Changed CommonRestResponse.lastModifiedTime to be lastModified. | ||
* Added statusCode property to CommonRestResponse. | ||
* Change dateProperty to be date on all generated types. | ||
* Fixed a bug that prevented proper reset of body stream upon retry. | ||
* Updated the defaults for RequestRetryOptions. | ||
|
||
2018.04.27 Version 10.0.0-preview | ||
* Initial Release. Please see the README and wiki for information on the new design. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
src/main/java/com/microsoft/azure/storage/blob/DownloadResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
* Copyright Microsoft Corporation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.microsoft.azure.storage.blob; | ||
|
||
import com.microsoft.azure.storage.blob.models.BlobsDownloadHeaders; | ||
import com.microsoft.rest.v2.RestResponse; | ||
import io.reactivex.Flowable; | ||
import io.reactivex.Single; | ||
import io.reactivex.internal.functions.Functions; | ||
|
||
import java.io.Closeable; | ||
import java.nio.ByteBuffer; | ||
import java.util.Map; | ||
|
||
/** | ||
* {@code DownloadResponse} wraps the protocol-layer response from {@link BlobURL#download(BlobRange, | ||
* BlobAccessConditions, boolean)} to help provide information for retrying. | ||
*/ | ||
public class DownloadResponse extends RestResponse<BlobsDownloadHeaders, Flowable<ByteBuffer>> implements Closeable { | ||
private BlobURL blobURL; | ||
|
||
private RetryReader.HTTPGetterInfo info; | ||
|
||
DownloadResponse(int statusCode, BlobsDownloadHeaders blobsDownloadHeaders, Map<String, String> rawHeaders, | ||
Flowable<ByteBuffer> byteBufferFlowable) { | ||
super(statusCode, blobsDownloadHeaders, rawHeaders, byteBufferFlowable); | ||
} | ||
|
||
/** | ||
* Constructs a new {@link RetryReader} stream for reliably reading data if desired (if {@code options != null} and | ||
* {@code options.maxRetryRequests > 0}. If retries are enabled, if a connection fails while reading, the {@code | ||
* RetryReader} will make additional requests to reestablish a connection and continue reading. | ||
* | ||
* @param options | ||
* {@link RetryReaderOptions} | ||
* @return A {@code Flowable} which emits the data as {@code ByteBuffer}s. | ||
*/ | ||
public Flowable<ByteBuffer> body(RetryReaderOptions options) { | ||
options = options == null ? new RetryReaderOptions() : options; | ||
if (options.maxRetryRequests == 0) { | ||
return super.body(); | ||
} | ||
return new RetryReader(Single.just(this), this.info, options, | ||
newInfo -> this.blobURL.download(new BlobRange(newInfo.offset, newInfo.count), new BlobAccessConditions( | ||
new HTTPAccessConditions(null, null, info.eTag, null), | ||
null, null, null), | ||
false)); | ||
} | ||
|
||
@Override | ||
public int statusCode() { | ||
return super.statusCode(); | ||
} | ||
|
||
@Override | ||
public BlobsDownloadHeaders headers() { | ||
return super.headers(); | ||
} | ||
|
||
@Override | ||
public Map<String, String> rawHeaders() { | ||
return super.rawHeaders(); | ||
} | ||
|
||
/** | ||
* Equivalent to calling {@link #body(RetryReaderOptions)} with {@code null}. | ||
*/ | ||
@Override | ||
public Flowable<ByteBuffer> body() { | ||
return this.body(null); | ||
} | ||
|
||
/** | ||
* Disposes of the connection associated with this stream response. | ||
*/ | ||
@Override | ||
public void close() { | ||
// Taken from BlobsDownloadResponse. | ||
body().subscribe(Functions.emptyConsumer(), Functions.<Throwable>emptyConsumer()).dispose(); | ||
} | ||
} |
Oops, something went wrong.