Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #524 from asorrin-msft/Azuremaster
Browse files Browse the repository at this point in the history
Azuremaster
  • Loading branch information
pemari-msft authored Aug 22, 2017
2 parents d6353c8 + 0be9b1c commit 7be6a47
Show file tree
Hide file tree
Showing 55 changed files with 1,063 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ public bool IsIncrementalCopy
get; internal set;
}

public Microsoft.WindowsAzure.Storage.Blob.StandardBlobTier? StandardBlobTier
{
get; internal set;
}

public Microsoft.WindowsAzure.Storage.Blob.RehydrationStatus? RehydrationStatus
{
get; internal set;
}

public Microsoft.WindowsAzure.Storage.Blob.PremiumPageBlobTier? PremiumPageBlobTier
{
get; internal set;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,18 @@ public virtual Task<string> StartCopyAsync(CloudFile source, AccessCondition sou
{
throw new System.NotImplementedException();
}
public virtual Task SetStandardBlobTierAsync(StandardBlobTier standardBlobTier)
{
throw new System.NotImplementedException();
}
public virtual Task SetStandardBlobTierAsync(StandardBlobTier standardBlobTier, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
{
throw new System.NotImplementedException();
}
public virtual Task SetStandardBlobTierAsync(StandardBlobTier standardBlobTier, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)
{
throw new System.NotImplementedException();
}
internal RESTCommand<CloudBlockBlob> CreateSnapshotImpl(IDictionary<string, string> metadata, AccessCondition accessCondition, BlobRequestOptions options)
{
throw new System.NotImplementedException();
Expand All @@ -263,7 +275,10 @@ internal RESTCommand<IEnumerable<ListBlockItem>> GetBlockListImpl(BlockListingFi
{
throw new System.NotImplementedException();
}

private RESTCommand<NullType> SetStandardBlobTierImpl(StandardBlobTier standardBlobTier, AccessCondition accessCondition, BlobRequestOptions options)
{
throw new System.NotImplementedException();
}
private IEnumerable<Stream> OpenMultiSubStream(Stream wrappedStream, long? length, SemaphoreSlim mutex)
{
throw new System.NotImplementedException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ private static bool CheckIfTrue(string header)
{
throw new System.NotImplementedException();
}
internal static void GetBlobTier(BlobType blobType, string blobTierString, out PremiumPageBlobTier? premiumPageBlobTier)
internal static void GetBlobTier(BlobType blobType, string blobTierString, out StandardBlobTier? standardBlobTier, out PremiumPageBlobTier? premiumPageBlobTier)
{
throw new System.NotImplementedException();
}
internal static RehydrationStatus? GetRehydrationStatus(string rehydrationStatus)
{
throw new System.NotImplementedException();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

namespace Microsoft.WindowsAzure.Storage.Blob
{
public enum RehydrationStatus
{
Unknown,
PendingToHot,
PendingToCool,
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

namespace Microsoft.WindowsAzure.Storage.Blob
{
public enum StandardBlobTier
{
Unknown,
Hot,
Cool,
Archive,
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ public string ClientRequestID
get; set;
}

public string CustomUserAgent
{
get; set;
}

public static LogLevel DefaultLogLevel
{
get; set;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,13 @@ internal static class Constants
public const string CopySuccessValue = "success";
public const string CopyAbortedValue = "aborted";
public const string CopyFailedValue = "failed";
public const string RehydratePendingToHot = "rehydrate-pending-to-hot";
public const string RehydratePendingToCool = "rehydrate-pending-to-cool";
public const string GeoUnavailableValue = "unavailable";
public const string GeoLiveValue = "live";
public const string GeoBootstrapValue = "bootstrap";
public const string AccessTierElement = "AccessTier";
public const string ArchiveStatusElement = "ArchiveStatus";
public const string BlobTypeElement = "BlobType";
public const string LeaseStatusElement = "LeaseStatus";
public const string LeaseStateElement = "LeaseState";
Expand Down Expand Up @@ -246,7 +249,7 @@ public static class EncryptionConstants
public const string TableEncryptionKeyDetails = "_ClientEncryptionMetadata1";
public const string TableEncryptionPropertyDetails = "_ClientEncryptionMetadata2";
public const string AgentMetadataKey = "EncryptionLibrary";
public const string AgentMetadataValue = ".NET 8.3.0";
public const string AgentMetadataValue = ".NET 8.4.0";
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static class EncryptionConstants
public const string TableEncryptionKeyDetails = "_ClientEncryptionMetadata1";
public const string TableEncryptionPropertyDetails = "_ClientEncryptionMetadata2";
public const string AgentMetadataKey = "EncryptionLibrary";
public const string AgentMetadataValue = ".NET 8.3.0";
public const string AgentMetadataValue = ".NET 8.4.0";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ namespace Microsoft.WindowsAzure.Storage.Shared.Protocol

public static class HeaderConstants
{
public static readonly string UserAgent = "Azure-Storage/8.3.0 ";
public static readonly string UserAgent = "Azure-Storage/8.4.0 ";
public const string UserAgentProductName = "Azure-Storage";
public const string UserAgentProductVersion = "8.3.0";
public const string UserAgentProductVersion = "8.4.0";
public const string PrefixForStorageHeader = "x-ms-";
public const string TrueHeader = "true";
public const string FalseHeader = "false";
Expand Down Expand Up @@ -39,6 +39,7 @@ public static class HeaderConstants
public const string SnapshotHeader = "x-ms-snapshot";
public const string DeleteSnapshotHeader = "x-ms-delete-snapshots";
public const string AccessTierHeader = "x-ms-access-tier";
public const string ArchiveStatusHeader = "x-ms-archive-status";
public const string AccessTierInferredHeader = "x-ms-access-tier-inferred";
public const string BlobCacheControlHeader = "x-ms-blob-cache-control";
public const string BlobContentDispositionRequestHeader = "x-ms-blob-content-disposition";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("8.3.0.0")]
[assembly: AssemblyFileVersion("8.3.0.0")]
[assembly: AssemblyVersion("8.4.0.0")]
[assembly: AssemblyFileVersion("8.4.0.0")]

[assembly: InternalsVisibleTo(
"Microsoft.WindowsAzure.Storage.Facade.Portable, PublicKey=" +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "Microsoft.WindowsAzure.Storage",
"version": "8.3.0.0",
"version": "8.4.0.0",

"authors": [ "Microsoft Corporation" ],
"description": "Azure Storage SDK for NetCore",
Expand Down
6 changes: 3 additions & 3 deletions Lib/AspNet/Microsoft.WindowsAzure.Storage/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("8.3.0.0")]
[assembly: AssemblyFileVersion("8.3.0.0")]
[assembly: AssemblyInformationalVersion("8.3.0.0")]
[assembly: AssemblyVersion("8.4.0.0")]
[assembly: AssemblyFileVersion("8.4.0.0")]
[assembly: AssemblyInformationalVersion("8.4.0.0")]


[assembly: InternalsVisibleTo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>WindowsAzure.Storage</id>
<version>8.3.0</version>
<version>8.4.0</version>
<title>Windows Azure Storage</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
Expand Down
2 changes: 1 addition & 1 deletion Lib/AspNet/Microsoft.WindowsAzure.Storage/project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "8.3.0.0",
"version": "8.4.0.0",

"authors": [ "Microsoft Corporation" ],
"description": "Azure Storage SDK for NetCore",
Expand Down
159 changes: 159 additions & 0 deletions Lib/ClassLibraryCommon/Blob/CloudBlockBlob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1850,6 +1850,125 @@ public virtual Task PutBlockAsync(string blockId, Stream blockData, string conte
}
#endif

#if SYNC
/// <summary>
/// Sets the tier of the blob on a standard storage account.
/// </summary>
/// <param name="standardBlobTier">A <see cref="StandardBlobTier"/> representing the tier to set.</param>
/// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed. If <c>null</c>, no condition is used.</param>
/// <param name="options">A <see cref="BlobRequestOptions"/> object that specifies additional options for the request, or <c>null</c>. If <c>null</c>, default options are applied to the request.</param>
/// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
[DoesServiceRequest]
public virtual void SetStandardBlobTier(StandardBlobTier standardBlobTier, AccessCondition accessCondition = null, BlobRequestOptions options = null, OperationContext operationContext = null)
{
this.attributes.AssertNoSnapshot();
BlobRequestOptions modifiedOptions = BlobRequestOptions.ApplyDefaults(options, BlobType.BlockBlob, this.ServiceClient);
Executor.ExecuteSync(
this.SetStandardBlobTierImpl(standardBlobTier, accessCondition, modifiedOptions),
modifiedOptions.RetryPolicy,
operationContext);
}
#endif

/// <summary>
/// Begins an asynchronous operation to set the tier of the blob on a standard storage account.
/// </summary>
/// <param name="standardBlobTier">A <see cref="StandardBlobTier"/> representing the tier to set.</param>
/// <param name="callback">An <see cref="AsyncCallback"/> delegate that will receive notification when the asynchronous operation completes.</param>
/// <param name="state">A user-defined object that will be passed to the callback delegate.</param>
/// <returns>An <see cref="ICancellableAsyncResult"/> that references the asynchronous operation.</returns>
[DoesServiceRequest]
public virtual ICancellableAsyncResult BeginSetStandardBlobTier(StandardBlobTier standardBlobTier, AsyncCallback callback, object state)
{
return this.BeginSetStandardBlobTier(standardBlobTier, null /* accessCondition */, null /* options */, null /* operationContext */, callback, state);
}

/// <summary>
/// Begins an asynchronous operation to set the tier of the blob on a standard storage account.
/// </summary>
/// <param name="standardBlobTier">A <see cref="StandardBlobTier"/> representing the tier to set.</param>
/// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed. If <c>null</c>, no condition is used.</param>
/// <param name="options">A <see cref="BlobRequestOptions"/> object that specifies additional options for the request, or <c>null</c>.</param>
/// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
/// <param name="callback">An <see cref="AsyncCallback"/> delegate that will receive notification when the asynchronous operation completes.</param>
/// <param name="state">A user-defined object that will be passed to the callback delegate.</param>
/// <returns>An <see cref="ICancellableAsyncResult"/> that references the asynchronous operation.</returns>
[DoesServiceRequest]
public virtual ICancellableAsyncResult BeginSetStandardBlobTier(StandardBlobTier standardBlobTier, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state)
{
this.attributes.AssertNoSnapshot();
BlobRequestOptions modifiedOptions = BlobRequestOptions.ApplyDefaults(options, BlobType.BlockBlob, this.ServiceClient);
return Executor.BeginExecuteAsync(
this.SetStandardBlobTierImpl(standardBlobTier, accessCondition, modifiedOptions),
modifiedOptions.RetryPolicy,
operationContext,
callback,
state);
}

/// <summary>
/// Ends an asynchronous operation to set the tier of the blob on a standard storage account.
/// </summary>
/// <param name="asyncResult">An <see cref="IAsyncResult"/> that references the pending asynchronous operation.</param>
public virtual void EndSetStandardBlobTier(IAsyncResult asyncResult)
{
Executor.EndExecuteAsync<NullType>(asyncResult);
}

#if TASK
/// <summary>
/// Initiates an asynchronous operation to set the tier of the blob on a standard storage account.
/// </summary>
/// <param name="standardBlobTier">A <see cref="StandardBlobTier"/> representing the tier to set.</param>
/// <returns>A <see cref="Task"/> object that represents the asynchronous operation.</returns>
[DoesServiceRequest]
public virtual Task SetStandardBlobTierAsync(StandardBlobTier standardBlobTier)
{
return this.SetStandardBlobTierAsync(standardBlobTier, CancellationToken.None);
}

/// <summary>
/// Initiates an asynchronous operation to set the tier of the blob on a standard storage account.
/// </summary>
/// <param name="standardBlobTier">A <see cref="StandardBlobTier"/> representing the tier to set.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> to observe while waiting for a task to complete.</param>
/// <returns>A <see cref="Task"/> object that represents the asynchronous operation.</returns>
[DoesServiceRequest]
public virtual Task SetStandardBlobTierAsync(StandardBlobTier standardBlobTier, CancellationToken cancellationToken)
{
return AsyncExtensions.TaskFromVoidApm(this.BeginSetStandardBlobTier, this.EndSetStandardBlobTier, standardBlobTier, cancellationToken);
}

/// <summary>
/// Initiates an asynchronous operation to set the tier of the blob on a standard storage account.
/// </summary>
/// <param name="standardBlobTier">A <see cref="StandardBlobTier"/> representing the tier to set.</param>
/// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed. If <c>null</c>, no condition is used.</param>
/// <param name="options">A <see cref="BlobRequestOptions"/> object that specifies additional options for the request.</param>
/// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
/// <returns>A <see cref="Task"/> object that represents the asynchronous operation.</returns>
[DoesServiceRequest]
public virtual Task SetStandardBlobTierAsync(StandardBlobTier standardBlobTier, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
{
return this.SetStandardBlobTierAsync(standardBlobTier, accessCondition, options, operationContext, CancellationToken.None);
}

/// <summary>
/// Initiates an asynchronous operation to set the tier of the blob on a standard storage account.
/// </summary>
/// <param name="standardBlobTier">A <see cref="StandardBlobTier"/> representing the tier to set.</param>
/// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed. If <c>null</c>, no condition is used.</param>
/// <param name="options">A <see cref="BlobRequestOptions"/> object that specifies additional options for the request.</param>
/// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> to observe while waiting for a task to complete.</param>
/// <returns>A <see cref="Task"/> object that represents the asynchronous operation.</returns>
[DoesServiceRequest]
public virtual Task SetStandardBlobTierAsync(StandardBlobTier standardBlobTier, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)
{
return AsyncExtensions.TaskFromVoidApm(this.BeginSetStandardBlobTier, this.EndSetStandardBlobTier, standardBlobTier, accessCondition, options, operationContext, cancellationToken);
}
#endif

#if SYNC
/// <summary>
/// Begins an operation to start copying an Azure file's contents, properties, and metadata to this block blob.
Expand Down Expand Up @@ -2594,6 +2713,46 @@ internal RESTCommand<CloudBlockBlob> CreateSnapshotImpl(IDictionary<string, stri
return putCmd;
}

/// <summary>
/// Implementation method for the SetBlobTier methods.
/// </summary>
/// <param name="standardBlobTier">A <see cref="StandardBlobTier"/> representing the tier to set.</param>
/// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed. If <c>null</c>, no condition is used.</param>
/// <param name="options">A <see cref="BlobRequestOptions"/> object that specifies additional options for the request.</param>
/// <returns>A <see cref="RESTCommand{T}"/> that sets the blob tier.</returns>
private RESTCommand<NullType> SetStandardBlobTierImpl(StandardBlobTier standardBlobTier, AccessCondition accessCondition, BlobRequestOptions options)
{
RESTCommand<NullType> putCmd = new RESTCommand<NullType>(this.ServiceClient.Credentials, this.attributes.StorageUri);

options.ApplyToStorageCommand(putCmd);
putCmd.BuildRequestDelegate = (uri, builder, serverTimeout, useVersionHeader, ctx) => BlobHttpWebRequestFactory.SetBlobTier(uri, serverTimeout, standardBlobTier.ToString(), useVersionHeader, ctx);
putCmd.SignRequest = this.ServiceClient.AuthenticationHandler.SignRequest;
putCmd.PreProcessResponse = (cmd, resp, ex, ctx) =>
{
// OK is returned when the tier on the blob is done immediately while accepted occurs when the process of setting the tier has started but not completed.
HttpStatusCode[] expectedHttpStatusCodes = new HttpStatusCode[2];
expectedHttpStatusCodes[0] = HttpStatusCode.OK;
expectedHttpStatusCodes[1] = HttpStatusCode.Accepted;
HttpResponseParsers.ProcessExpectedStatusCodeNoException(expectedHttpStatusCodes, resp, null, cmd, ex);
CloudBlob.UpdateETagLMTLengthAndSequenceNumber(this.attributes, resp, false);

this.attributes.Properties.RehydrationStatus = null;
if (resp.StatusCode.Equals(HttpStatusCode.OK))
{
this.attributes.Properties.StandardBlobTier = standardBlobTier;
}
else
{
// If the status code is accepted, then the blob is currently in the archive state and being rehydrated to the new tier.
this.attributes.Properties.StandardBlobTier = StandardBlobTier.Archive;
}

return NullType.Value;
};

return putCmd;
}

private static bool IsLessThanSingleBlobThreshold(Stream source, long? length, BlobRequestOptions modifiedOptions, bool noPadding)
{
if (!source.CanSeek)
Expand Down
Loading

0 comments on commit 7be6a47

Please sign in to comment.