| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System; |
| | 5 | | using System.ComponentModel; |
| | 6 | |
|
| | 7 | | namespace Azure.Storage |
| | 8 | | { |
| | 9 | | /// <summary> |
| | 10 | | /// <see cref="StorageTransferOptions"/> is used to provide options for parallel transfers. |
| | 11 | | /// </summary> |
| | 12 | | public struct StorageTransferOptions : IEquatable<StorageTransferOptions> |
| | 13 | | { |
| | 14 | | /// <summary> |
| | 15 | | /// The maximum length of an transfer in bytes. This property is a backwards-compatible |
| | 16 | | /// facade for <see cref="MaximumTransferSize"/>, which supports long values. Use |
| | 17 | | /// <see cref="MaximumTransferSize"/> for full access of supported values. |
| | 18 | | /// </summary> |
| | 19 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| | 20 | | public int? MaximumTransferLength |
| | 21 | | { |
| 0 | 22 | | get => (int?)MaximumTransferSize; |
| 152 | 23 | | set => MaximumTransferSize = value; |
| | 24 | | } |
| | 25 | |
|
| | 26 | | /// <summary> |
| | 27 | | /// The maximum length of an transfer in bytes. |
| | 28 | | /// </summary> |
| 3068 | 29 | | public long? MaximumTransferSize { get; set; } |
| | 30 | |
|
| | 31 | | /// <summary> |
| | 32 | | /// The maximum number of workers that may be used in a parallel transfer. |
| | 33 | | /// </summary> |
| 2500 | 34 | | public int? MaximumConcurrency { get; set; } |
| | 35 | |
|
| | 36 | | /// <summary> |
| | 37 | | /// The size of the first range request in bytes. Blobs smaller than this limit will |
| | 38 | | /// be downloaded in a single request. Blobs larger than this limit will continue being |
| | 39 | | /// downloaded in chunks of size <see cref="MaximumTransferSize"/>. This property is a |
| | 40 | | /// backwards-compatible facade for <see cref="MaximumTransferSize"/>, which supports |
| | 41 | | /// long values. Use <see cref="InitialTransferSize"/> for full access of supported values. |
| | 42 | | /// </summary> |
| | 43 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| | 44 | | public int? InitialTransferLength |
| | 45 | | { |
| 0 | 46 | | get => (int?)InitialTransferSize; |
| 80 | 47 | | set => InitialTransferSize = value; |
| | 48 | | } |
| | 49 | |
|
| | 50 | | /// <summary> |
| | 51 | | /// The size of the first range request in bytes. Blobs smaller than this limit will |
| | 52 | | /// be downloaded in a single request. Blobs larger than this limit will continue being |
| | 53 | | /// downloaded in chunks of size <see cref="MaximumTransferSize"/>. |
| | 54 | | /// </summary> |
| 2840 | 55 | | public long? InitialTransferSize { get; set; } |
| | 56 | |
|
| | 57 | | /// <summary> |
| | 58 | | /// Check if two ParallelTransferOptions instances are equal. |
| | 59 | | /// </summary> |
| | 60 | | /// <param name="obj">The instance to compare to.</param> |
| | 61 | | /// <returns>True if they're equal, false otherwise.</returns> |
| | 62 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| | 63 | | public override bool Equals(object obj) |
| 0 | 64 | | => obj is StorageTransferOptions other |
| 0 | 65 | | && Equals(other) |
| | 66 | | ; |
| | 67 | |
|
| | 68 | | /// <summary> |
| | 69 | | /// Get a hash code for the ParallelTransferOptions. |
| | 70 | | /// </summary> |
| | 71 | | /// <returns>Hash code for the ParallelTransferOptions.</returns> |
| | 72 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| | 73 | | public override int GetHashCode() |
| 0 | 74 | | => MaximumTransferSize.GetHashCode() |
| 0 | 75 | | ^ MaximumConcurrency.GetHashCode() |
| 0 | 76 | | ^ InitialTransferSize.GetHashCode() |
| | 77 | | ; |
| | 78 | |
|
| | 79 | | /// <summary> |
| | 80 | | /// Check if two ParallelTransferOptions instances are equal. |
| | 81 | | /// </summary> |
| | 82 | | /// <param name="left">The first instance to compare.</param> |
| | 83 | | /// <param name="right">The second instance to compare.</param> |
| | 84 | | /// <returns>True if they're equal, false otherwise.</returns> |
| | 85 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| 0 | 86 | | public static bool operator ==(StorageTransferOptions left, StorageTransferOptions right) => left.Equals(right); |
| | 87 | |
|
| | 88 | | /// <summary> |
| | 89 | | /// Check if two ParallelTransferOptions instances are equal. |
| | 90 | | /// </summary> |
| | 91 | | /// <param name="left">The first instance to compare.</param> |
| | 92 | | /// <param name="right">The second instance to compare.</param> |
| | 93 | | /// <returns>True if they're not equal, false otherwise.</returns> |
| | 94 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| 0 | 95 | | public static bool operator !=(StorageTransferOptions left, StorageTransferOptions right) => !(left == right); |
| | 96 | |
|
| | 97 | | /// <summary> |
| | 98 | | /// Check if two ParallelTransferOptions instances are equal. |
| | 99 | | /// </summary> |
| | 100 | | /// <param name="obj">The instance to compare to.</param> |
| | 101 | | /// <returns>True if they're equal, false otherwise.</returns> |
| | 102 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| | 103 | | public bool Equals(StorageTransferOptions obj) |
| 0 | 104 | | => MaximumTransferSize == obj.MaximumTransferSize |
| 0 | 105 | | && MaximumConcurrency == obj.MaximumConcurrency |
| 0 | 106 | | && InitialTransferSize == obj.InitialTransferSize |
| | 107 | | ; |
| | 108 | | } |
| | 109 | | } |