-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Added Seal Append Blob #11262
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 Seal Append Blob #11262
Changes from 6 commits
d3d204e
75c6fd7
2575619
49c20c6
f4ef1e6
08a6db0
c56d8c1
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 |
|---|---|---|
|
|
@@ -339,6 +339,7 @@ public BlobDownloadDetails() { } | |
| public string EncryptionKeySha256 { get { throw null; } } | ||
| public string EncryptionScope { get { throw null; } } | ||
| public Azure.ETag ETag { get { throw null; } } | ||
| public bool IsSealed { get { throw null; } } | ||
| public bool IsServerEncrypted { get { throw null; } } | ||
| public System.DateTimeOffset LastModified { get { throw null; } } | ||
| public Azure.Storage.Blobs.Models.LeaseDurationType LeaseDuration { get { throw null; } } | ||
|
|
@@ -1007,6 +1008,16 @@ public enum SkuName | |
| StandardZrs = 3, | ||
| PremiumLrs = 4, | ||
| } | ||
| public partial class StartCopyFromUriOptions | ||
| { | ||
| public StartCopyFromUriOptions() { } | ||
| public Azure.Storage.Blobs.Models.AccessTier? AccessTier { get { throw null; } set { } } | ||
| public Azure.Storage.Blobs.Models.BlobRequestConditions DestinationConditions { get { throw null; } set { } } | ||
| public System.Collections.Generic.IDictionary<string, string> Metadata { get { throw null; } set { } } | ||
| public Azure.Storage.Blobs.Models.RehydratePriority? RehydratePriority { get { throw null; } set { } } | ||
| public bool? SealBlob { get { throw null; } set { } } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we make this
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, that seems reasonable. |
||
| public Azure.Storage.Blobs.Models.BlobRequestConditions SourceConditions { get { throw null; } set { } } | ||
| } | ||
| public partial class UserDelegationKey | ||
| { | ||
| internal UserDelegationKey() { } | ||
|
|
@@ -1039,6 +1050,8 @@ public AppendBlobClient(System.Uri blobUri, Azure.Storage.StorageSharedKeyCreden | |
| public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo>> CreateAsync(Azure.Storage.Blobs.Models.BlobHttpHeaders httpHeaders = null, System.Collections.Generic.IDictionary<string, string> metadata = null, Azure.Storage.Blobs.Models.AppendBlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } | ||
| public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo> CreateIfNotExists(Azure.Storage.Blobs.Models.BlobHttpHeaders httpHeaders = null, System.Collections.Generic.IDictionary<string, string> metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } | ||
| public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo>> CreateIfNotExistsAsync(Azure.Storage.Blobs.Models.BlobHttpHeaders httpHeaders = null, System.Collections.Generic.IDictionary<string, string> metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } | ||
| public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobInfo> Seal(Azure.Storage.Blobs.Models.AppendBlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } | ||
| public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobInfo>> SealAsync(Azure.Storage.Blobs.Models.AppendBlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } | ||
| public new Azure.Storage.Blobs.Specialized.AppendBlobClient WithSnapshot(string snapshot) { throw null; } | ||
| } | ||
| public partial class BlobBaseClient | ||
|
|
@@ -1089,7 +1102,11 @@ public BlobBaseClient(System.Uri blobUri, Azure.Storage.StorageSharedKeyCredenti | |
| public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobInfo>> SetHttpHeadersAsync(Azure.Storage.Blobs.Models.BlobHttpHeaders httpHeaders = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } | ||
| public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobInfo> SetMetadata(System.Collections.Generic.IDictionary<string, string> metadata, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } | ||
| public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobInfo>> SetMetadataAsync(System.Collections.Generic.IDictionary<string, string> metadata, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } | ||
| public virtual Azure.Storage.Blobs.Models.CopyFromUriOperation StartCopyFromUri(System.Uri source, Azure.Storage.Blobs.Models.StartCopyFromUriOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } | ||
| [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] | ||
| public virtual Azure.Storage.Blobs.Models.CopyFromUriOperation StartCopyFromUri(System.Uri source, System.Collections.Generic.IDictionary<string, string> metadata = null, Azure.Storage.Blobs.Models.AccessTier? accessTier = default(Azure.Storage.Blobs.Models.AccessTier?), Azure.Storage.Blobs.Models.BlobRequestConditions sourceConditions = null, Azure.Storage.Blobs.Models.BlobRequestConditions destinationConditions = null, Azure.Storage.Blobs.Models.RehydratePriority? rehydratePriority = default(Azure.Storage.Blobs.Models.RehydratePriority?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } | ||
| public virtual System.Threading.Tasks.Task<Azure.Storage.Blobs.Models.CopyFromUriOperation> StartCopyFromUriAsync(System.Uri source, Azure.Storage.Blobs.Models.StartCopyFromUriOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } | ||
| [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] | ||
| public virtual System.Threading.Tasks.Task<Azure.Storage.Blobs.Models.CopyFromUriOperation> StartCopyFromUriAsync(System.Uri source, System.Collections.Generic.IDictionary<string, string> metadata = null, Azure.Storage.Blobs.Models.AccessTier? accessTier = default(Azure.Storage.Blobs.Models.AccessTier?), Azure.Storage.Blobs.Models.BlobRequestConditions sourceConditions = null, Azure.Storage.Blobs.Models.BlobRequestConditions destinationConditions = null, Azure.Storage.Blobs.Models.RehydratePriority? rehydratePriority = default(Azure.Storage.Blobs.Models.RehydratePriority?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } | ||
| public virtual Azure.Response Undelete(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } | ||
| public virtual System.Threading.Tasks.Task<Azure.Response> UndeleteAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1018,6 +1018,134 @@ private async Task<Response<BlobAppendInfo>> AppendBlockFromUriInternal( | |
| } | ||
| } | ||
| #endregion AppendBlockFromUri | ||
|
|
||
| #region Seal | ||
| /// <summary> | ||
| /// Seals the append blob, making it read only. | ||
| /// Any subsequent appends will fail. | ||
| /// </summary> | ||
| /// <param name="conditions"> | ||
| /// Optional <see cref="AppendBlobRequestConditions"/> to add | ||
| /// conditions on the sealing of this blob. | ||
| /// </param> | ||
| /// <param name="cancellationToken"> | ||
| /// Optional <see cref="CancellationToken"/> to propagate | ||
| /// notifications that the operation should be cancelled. | ||
| /// </param> | ||
| /// <returns> | ||
| /// A <see cref="Response{BlobInfo}"/> describing the | ||
| /// state of the sealed append blob. | ||
| /// </returns> | ||
| /// <remarks> | ||
| /// A <see cref="RequestFailedException"/> will be thrown if | ||
| /// a failure occurs. | ||
| /// </remarks> | ||
| public virtual Response<BlobInfo> Seal( | ||
| AppendBlobRequestConditions conditions = default, | ||
| CancellationToken cancellationToken = default) | ||
| => SealInternal( | ||
| conditions, | ||
| async: false, | ||
| cancellationToken: cancellationToken) | ||
| .EnsureCompleted(); | ||
|
|
||
| /// <summary> | ||
| /// Seals the append blob, making it read only. | ||
| /// Any subsequent appends will fail. | ||
| /// </summary> | ||
| /// <param name="conditions"> | ||
| /// Optional <see cref="AppendBlobRequestConditions"/> to add | ||
| /// conditions on the sealing of this blob. | ||
| /// </param> | ||
| /// <param name="cancellationToken"> | ||
| /// Optional <see cref="CancellationToken"/> to propagate | ||
| /// notifications that the operation should be cancelled. | ||
| /// </param> | ||
| /// <returns> | ||
| /// A <see cref="Response{BlobInfo}"/> describing the | ||
| /// state of the sealed append blob. | ||
| /// </returns> | ||
| /// <remarks> | ||
| /// A <see cref="RequestFailedException"/> will be thrown if | ||
| /// a failure occurs. | ||
| /// </remarks> | ||
| public virtual async Task<Response<BlobInfo>> SealAsync( | ||
| AppendBlobRequestConditions conditions = default, | ||
| CancellationToken cancellationToken = default) | ||
| => await SealInternal( | ||
| conditions, | ||
| async: true, | ||
| cancellationToken: cancellationToken) | ||
| .ConfigureAwait(false); | ||
|
|
||
| /// <summary> | ||
| /// Seals the append blob, making it read only. | ||
| /// Any subsequent appends will fail. | ||
| /// </summary> | ||
| /// <param name="conditions"> | ||
| /// Optional <see cref="AppendBlobRequestConditions"/> to add | ||
| /// conditions on the sealing of this blob. | ||
| /// </param> | ||
| /// <param name="async"> | ||
| /// Whether to invoke the operation asynchronously. | ||
| /// </param> | ||
| /// <param name="cancellationToken"> | ||
| /// Optional <see cref="CancellationToken"/> to propagate | ||
| /// notifications that the operation should be cancelled. | ||
| /// </param> | ||
| /// <returns> | ||
| /// A <see cref="Response{BlobInfo}"/> describing the | ||
| /// state of the sealed append blob. | ||
| /// </returns> | ||
| /// <remarks> | ||
| /// A <see cref="RequestFailedException"/> will be thrown if | ||
| /// a failure occurs. | ||
| /// </remarks> | ||
| private async Task<Response<BlobInfo>> SealInternal( | ||
| AppendBlobRequestConditions conditions, | ||
| bool async, | ||
| CancellationToken cancellationToken) | ||
| { | ||
| using (Pipeline.BeginLoggingScope(nameof(AppendBlobClient))) | ||
| { | ||
| try | ||
| { | ||
| Response<AppendBlobSealInternal> response = await BlobRestClient.AppendBlob.SealAsync( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not seeing
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, it's just ETag, LastModified, and a boolean IsSealed. |
||
| ClientDiagnostics, | ||
| Pipeline, | ||
| Uri, | ||
| Version.ToVersionString(), | ||
| leaseId: conditions?.LeaseId, | ||
| ifModifiedSince: conditions?.IfModifiedSince, | ||
| ifUnmodifiedSince: conditions?.IfUnmodifiedSince, | ||
| ifMatch: conditions?.IfMatch, | ||
| ifNoneMatch: conditions?.IfNoneMatch, | ||
| appendPosition: conditions?.IfAppendPositionEqual, | ||
| async: async, | ||
| operationName: $"{nameof(AppendBlobClient)}.{nameof(Seal)}", | ||
| cancellationToken: cancellationToken) | ||
| .ConfigureAwait(false); | ||
|
|
||
| return Response.FromValue( | ||
| new BlobInfo | ||
| { | ||
| ETag = response.Value.ETag, | ||
| LastModified = response.Value.LastModified | ||
| }, | ||
| response.GetRawResponse()); | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| Pipeline.LogException(ex); | ||
| throw; | ||
| } | ||
| finally | ||
| { | ||
| Pipeline.LogMethodExit(nameof(AppendBlobClient)); | ||
| } | ||
| } | ||
| } | ||
| #endregion Seal | ||
| } | ||
|
|
||
| /// <summary> | ||
|
|
||
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.
Should this just be
CopyFromUriOptions? TheStartprefix is only to signify that it's an LRO and not part of the operation name. I'll ping @KrzysztofCwalina to see if he has a preference and get back to you ASAP.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'd vote for
CopyBlobFromUriOptions, it's less generic.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.
Krzysztof is in favor of shorter/simpler names when we can make sure we're not going to end up with conflicts down the road. I'm not worried about adding a
CopyFromUriAsyncthat would take different parameters so that's fine.I think you bring up a really good point that we may possibly end up adding other copy operations in the future. How about
BlobCopyFromUriOptionssince other copy operations would probably be operating on blobs and the pattern we've been going with is[Operation]Optionswhen possible or[FooClient - Client][Operation]Options? This would leave us room for(BlobContainer/Service/????)CopyFromUriOptionsif ever needed.Does that sound reasonable? Ping me if you want to chat more to hopefully unblock this faster.
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
BlobCopyFromUriOptionssounds good.