-
Notifications
You must be signed in to change notification settings - Fork 873
Update TransferUtilityConfig and BaseDownloadRequest to add multipartdownload config options #4120
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
base: feature/transfermanager
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "services": [ | ||
| { | ||
| "serviceName": "S3", | ||
| "type": "patch", | ||
| "changeLogMessages": [ | ||
| "Added MaxInMemoryParts property to TransferUtilityConfig for controlling memory usage during multipart downloads", | ||
| "Added PartSize property to BaseDownloadRequest for configuring multipart download part sizes", | ||
| "Added MultipartDownloadType enum and property to BaseDownloadRequest for selecting download strategy" | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -28,6 +28,22 @@ | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| namespace Amazon.S3.Transfer | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||
| /// Specifies the strategy for multipart downloads | ||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||
| public enum MultipartDownloadType | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||
| /// Use part-based downloads with original upload part boundaries | ||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||
| PART, | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||
| /// Use range-based downloads with configurable part sizes | ||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||
| RANGE | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||
| /// The base class for requests that return Amazon S3 objects. | ||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||
|
|
@@ -50,6 +66,8 @@ public abstract class BaseDownloadRequest | |||||||||||||||||||||
| private string ifMatch; | ||||||||||||||||||||||
| private string ifNoneMatch; | ||||||||||||||||||||||
| private ResponseHeaderOverrides responseHeaders; | ||||||||||||||||||||||
| private long? partSize; | ||||||||||||||||||||||
| private MultipartDownloadType multipartDownloadType = MultipartDownloadType.PART; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||
| /// Gets or sets the name of the bucket. | ||||||||||||||||||||||
|
|
@@ -330,5 +348,45 @@ public ResponseHeaderOverrides ResponseHeaderOverrides | |||||||||||||||||||||
| this.responseHeaders = value; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||
| /// Gets or sets the part size of the download in bytes. | ||||||||||||||||||||||
| /// The downloaded file will be divided into | ||||||||||||||||||||||
| /// parts the size specified and | ||||||||||||||||||||||
| /// downloaded from Amazon S3 individually. | ||||||||||||||||||||||
| /// This is used when MultipartDownloadType is set to RANGE. | ||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||
| /// <value> | ||||||||||||||||||||||
| /// The part size of the download. | ||||||||||||||||||||||
| /// </value> | ||||||||||||||||||||||
| public long PartSize | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| get { return this.partSize.GetValueOrDefault(); } | ||||||||||||||||||||||
| set { this.partSize = value; } | ||||||||||||||||||||||
|
||||||||||||||||||||||
| set { this.partSize = value; } | |
| set | |
| { | |
| if (value <= 0) | |
| { | |
| throw new ArgumentOutOfRangeException(nameof(PartSize), "PartSize must be a positive value."); | |
| } | |
| this.partSize = value; | |
| } |
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.
we dont do this for multi part upload in this area
| public long PartSize |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -42,6 +42,7 @@ public partial class TransferUtilityConfig | |||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
| long _minSizeBeforePartUpload = 16 * (long)Math.Pow(2, 20); | ||||||||||||||||||||||||||||||||||||
| int _concurrentServiceRequests; | ||||||||||||||||||||||||||||||||||||
| int _maxInMemoryParts = 1024; // When combined with the default part size of 8MB, we get 8GB of memory being utilized as the default. | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||||
| /// Default constructor. | ||||||||||||||||||||||||||||||||||||
|
|
@@ -81,5 +82,21 @@ public int ConcurrentServiceRequests | |||||||||||||||||||||||||||||||||||
| this._concurrentServiceRequests = value; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||||
| /// Gets or sets the maximum number of parts to buffer in memory during multipart downloads. | ||||||||||||||||||||||||||||||||||||
| /// The default value is 1024. | ||||||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||||||
| public int MaxInMemoryParts | ||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
| get { return this._maxInMemoryParts; } | ||||||||||||||||||||||||||||||||||||
| set | ||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
| if (value < 1) | ||||||||||||||||||||||||||||||||||||
| value = 1; | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+90
to
+96
|
||||||||||||||||||||||||||||||||||||
| public int MaxInMemoryParts | |
| { | |
| get { return this._maxInMemoryParts; } | |
| set | |
| { | |
| if (value < 1) | |
| value = 1; | |
| /// <remarks> | |
| /// Throws <see cref="ArgumentOutOfRangeException"/> if the value is less than 1. | |
| /// </remarks> | |
| public int MaxInMemoryParts | |
| { | |
| get { return this._maxInMemoryParts; } | |
| set | |
| { | |
| if (value < 1) | |
| throw new ArgumentOutOfRangeException(nameof(value), "MaxInMemoryParts must be greater than 0."); |
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.
wondering what the correct procedure is. i think argumentoutorrange makes sense but im not sure why we silently updated the value for concurrentservicerequests?
Uh oh!
There was an error while loading. Please reload this page.