This commit is contained in:
Xiaoning Liu 2017-08-20 23:52:39 +08:00 коммит произвёл Vincent Jiang (LEI)
Родитель 611a9e9caa
Коммит 2a443b90e1
12 изменённых файлов: 1937 добавлений и 8 удалений

Просмотреть файл

@ -1,6 +1,11 @@
Note: This is an Azure Storage only package. The all up Azure node sdk still has the old storage bits in there. In a future release, those storage bits will be removed and an npm dependency to this storage node sdk will
be taken. This is a GA release and the changes described below indicate the changes from the Azure node SDK 0.9.8 available here - https://github.com/Azure/azure-sdk-for-node.
2017.08 Version 2.4.0
BLOB
* Added support for getting and setting a tier for a block blob under a LRS Blob Storage Account from tiers hot, cool and archive.
2017.08 Version 2.3.0
ALL

Просмотреть файл

@ -1,5 +1,9 @@
Note: This is the change log file for Azure Storage JavaScript Client Library.
2017.08 Version 0.2.4-preview.10
* Generated browser compatible JavaScript files based on Microsoft Azure Storage SDK for Node.js 2.4.0.
2017.08 Version 0.2.3-preview.9
* Generated browser compatible JavaScript files based on Microsoft Azure Storage SDK for Node.js 2.3.0.

Просмотреть файл

@ -37,7 +37,7 @@ var Constants = {
* @const
* @type {string}
*/
USER_AGENT_PRODUCT_VERSION: '2.3.0',
USER_AGENT_PRODUCT_VERSION: '2.4.0',
/**
* The number of default concurrent requests for parallel operation.
@ -1828,7 +1828,17 @@ var Constants = {
* @const
* @type {string}
*/
ACCESS_TIER_INFERRED: 'x-ms-access-tier-inferred'
ACCESS_TIER_INFERRED: 'x-ms-access-tier-inferred',
/**
* For BlobStorage LRS accounts, the header is returned if archive tier is set
* and rehydrate operation is pending for the request version is 2017-04-17 or later.
* The valid values are rehydrate-pending-to-hot or rehydrate-pending-to-cool.
*
* @const
* @type {string}
*/
ARCHIVE_STATUS: 'x-ms-archive-status'
},
QueryStringConstants: {

Просмотреть файл

@ -254,7 +254,10 @@ exports.blobTierNameIsValid = function (blobTier, callback) {
return fail(new ArgumentNullError('blobTier', 'Blob tier is not specified.'));
}
if (!_.chain(_.union(_.values(BlobUtilities.BlobTier.PremiumPageBlobTier)))
if (!_.chain(_.union(
_.values(BlobUtilities.BlobTier.PremiumPageBlobTier),
_.values(BlobUtilities.BlobTier.StandardBlobTier)
))
.map(function (val) { return val.toString().toUpperCase(); })
.contains(blobTier.toString().toUpperCase())
.value()) {

Просмотреть файл

@ -240,12 +240,12 @@ BlobService.prototype.setServiceProperties = function (serviceProperties, option
};
/**
* Sets the tier of a pageblob under a premium storage account.
* Sets the tier of a blockblob under a blob storage LRS account, or the tier of a pageblob under a premium storage account.
*
* @this {BlobService}
* @param {string} container The container name.
* @param {string} blob The blob name.
* @param {string} blobTier Please see BlobUtilities.BlobTier.PremiumPageBlobTier for possible values.
* @param {string} blobTier Please see BlobUtilities.BlobTier.StandardBlobTier or BlobUtilities.BlobTier.PremiumPageBlobTier for possible values.
* @param {LocationMode} [options.locationMode] Specifies the location mode used to decide which location the request should be sent to.
* Please see StorageUtilities.LocationMode for the possible values.
* @param {int} [options.timeoutIntervalInMs] The server timeout interval, in milliseconds, to use for the request.

Просмотреть файл

@ -108,6 +108,10 @@ var BlobUtilities = {
* @property {string} PremiumPageBlobTier.P40
* @property {string} PremiumPageBlobTier.P50
* @property {string} PremiumPageBlobTier.P60
* @property {object} StandardBlobTier Candidate values for standard blobs tiers.
* @property {string} StandardBlobTier.HOT
* @property {string} StandardBlobTier.COOL
* @property {string} StandardBlobTier.ARCHIVE
*/
BlobTier: {
PremiumPageBlobTier: {
@ -119,6 +123,11 @@ var BlobUtilities = {
P40: 'P40',
P50: 'P50',
P60: 'P60'
},
StandardBlobTier: {
HOT: 'Hot',
COOL: 'Cool',
ARCHIVE: 'Archive'
}
}
};

Просмотреть файл

@ -121,6 +121,7 @@ var headersForProperties = {
'accessTier': 'ACCESS_TIER',
'accessTierInferred': 'ACCESS_TIER_INFERRED',
'archiveStatus': 'ARCHIVE_STATUS',
'isIncrementalCopy': 'INCREMENTAL_COPY',

Просмотреть файл

@ -1,7 +1,7 @@
{
"name": "azure-storage",
"author": "Microsoft Corporation",
"version": "2.3.0",
"version": "2.4.0",
"description": "Microsoft Azure Storage Client Library for Node.js",
"typings": "typings/azure-storage/azure-storage.d.ts",
"tags": [

Просмотреть файл

@ -41,6 +41,10 @@ function TestSuite(testPrefix, env, forceMocked) {
name: 'AZURE_STORAGE_CONNECTION_STRING_PREMIUM_ACCOUNT',
secure: stripAccessKey,
optional: true
},{
name: 'AZURE_STORAGE_CONNECTION_STRING_BLOB_ACCOUNT_LRS',
secure: stripAccessKey,
optional: true
},{
name: 'AZURE_STORAGE_CONNECTION_STRING_SSE_ENABLED_ACCOUNT',
secure: stripAccessKey,

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -46,6 +46,211 @@ var containerName;
var blobName;
describe('BlobArchive', function () {
describe('Archive tests for block blobs in a blob storage account with LRS', function () {
before(function (done) {
if (!runBlockBlobSuite) {
done();
} else {
if (blockBlobSuite.isMocked) {
blockBlobSuite.POLL_REQUEST_INTERVAL = 0;
}
blockBlobSuite.setupSuite(function () {
// In mocked recording mode, the connection string environment is set in the suite.setupSuite()
blobAccountLRSConnectionString = process.env.AZURE_STORAGE_CONNECTION_STRING_BLOB_ACCOUNT_LRS;
blobService = azure.createBlobService(blobAccountLRSConnectionString).withFilter(new azure.ExponentialRetryPolicyFilter());
done();
});
}
});
after(function (done) {
if (!runBlockBlobSuite) {
done();
} else {
blockBlobSuite.teardownSuite(done);
}
});
beforeEach(function (done) {
if (!runBlockBlobSuite) {
done();
} else {
blockBlobSuite.setupTest(function () {
containerName = blockBlobSuite.getName(containerNamesPrefix).toLowerCase();
blobService.createContainerIfNotExists(containerName, function (createError, container, response) {
assert.equal(createError, null);
assert.notEqual(container, null);
blobName = blockBlobSuite.getName(blobNamesPrefix).toLowerCase();
var blobText = 'archive-test-blob';
blobService.createBlockBlobFromText(containerName, blobName, blobText, function (uploadError, blob, uploadResponse) {
assert.equal(uploadError, null);
assert.notEqual(blob, null);
assert.ok(uploadResponse.isSuccessful);
done();
});
});
});
}
});
afterEach(function (done) {
if (!runBlockBlobSuite) {
done();
} else {
blobService.deleteContainerIfExists(containerName, function (deleteError) {
assert.equal(deleteError, null);
blockBlobSuite.teardownTest(done);
});
}
});
runBlockBlobCase('setBlobTier should work setting tier to hot for a block blob without tier', function (done) {
blobService.setBlobTier(containerName, blobName, blobutil.BlobTier.StandardBlobTier.HOT, function (err, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, properties, resp) {
assert.equal(err, null);
assert.equal(properties.accessTier, blobutil.BlobTier.StandardBlobTier.HOT);
blobService.listBlobsSegmented(containerName, null, function (err, results, resp) {
assert.equal(err, null);
assert.equal(results.entries.length, 1);
assert.equal(results.entries[0].accessTier, blobutil.BlobTier.StandardBlobTier.HOT);
done();
});
});
});
});
runBlockBlobCase('setBlobTier should work setting tier to cool for a block blob without tier', function (done) {
blobService.setBlobTier(containerName, blobName, blobutil.BlobTier.StandardBlobTier.COOL, function (err, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, properties, resp) {
assert.equal(err, null);
assert.equal(properties.accessTier, blobutil.BlobTier.StandardBlobTier.COOL);
blobService.listBlobsSegmentedWithPrefix(containerName, '', null, function (err, results, resp) {
assert.equal(err, null);
assert.equal(results.entries.length, 1);
assert.equal(results.entries[0].accessTier, blobutil.BlobTier.StandardBlobTier.COOL);
done();
});
});
});
});
runBlockBlobCase('setBlobTier should work setting tier to archive for a block blob without tier', function (done) {
blobService.setBlobTier(containerName, blobName, blobutil.BlobTier.StandardBlobTier.ARCHIVE, function (err, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, properties, resp) {
assert.equal(err, null);
assert.equal(properties.accessTier, blobutil.BlobTier.StandardBlobTier.ARCHIVE);
blobService.listBlobsSegmented(containerName, null, function (err, results, resp) {
assert.equal(err, null);
assert.equal(results.entries.length, 1);
assert.equal(results.entries[0].accessTier, blobutil.BlobTier.StandardBlobTier.ARCHIVE);
done();
});
});
});
});
runBlockBlobCase('setBlobTier should work setting tier to hot for a block blob with archive tier', function (done) {
blobService.setBlobTier(containerName, blobName, blobutil.BlobTier.StandardBlobTier.ARCHIVE, function (err, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, properties, resp) {
assert.equal(err, null);
assert.equal(properties.accessTier, blobutil.BlobTier.StandardBlobTier.ARCHIVE);
blobService.setBlobTier(containerName, blobName, blobutil.BlobTier.StandardBlobTier.HOT, function (err, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, properties, resp) {
assert.equal(err, null);
assert.equal(properties.accessTier, blobutil.BlobTier.StandardBlobTier.ARCHIVE);
assert.equal(properties.archiveStatus, rehydrate2hot);
blobService.listBlobsSegmentedWithPrefix(containerName, '', null, function (err, results, resp) {
assert.equal(err, null);
assert.equal(results.entries.length, 1);
assert.equal(results.entries[0].accessTier, blobutil.BlobTier.StandardBlobTier.ARCHIVE);
assert.equal(results.entries[0].archiveStatus, rehydrate2hot);
done();
});
});
});
});
});
});
runBlockBlobCase('setBlobTier should work setting tier to cool for a block blob with archive tier', function (done) {
blobService.setBlobTier(containerName, blobName, blobutil.BlobTier.StandardBlobTier.ARCHIVE, function (err, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, properties, resp) {
assert.equal(err, null);
assert.equal(properties.accessTier, blobutil.BlobTier.StandardBlobTier.ARCHIVE);
blobService.setBlobTier(containerName, blobName, blobutil.BlobTier.StandardBlobTier.COOL, function (err, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, properties, resp) {
assert.equal(err, null);
assert.equal(properties.accessTier, blobutil.BlobTier.StandardBlobTier.ARCHIVE);
assert.equal(properties.archiveStatus, rehydrate2cool);
blobService.listBlobsSegmented(containerName, null, function (err, results, resp) {
assert.equal(err, null);
assert.equal(results.entries.length, 1);
assert.equal(results.entries[0].accessTier, blobutil.BlobTier.StandardBlobTier.ARCHIVE);
assert.equal(results.entries[0].archiveStatus, rehydrate2cool);
done();
});
});
});
});
});
});
runBlockBlobCase('setBlobTier should not work setting tier to cool for a block blob with Rehydrate-Pending-To-Hot status', function (done) {
blobService.setBlobTier(containerName, blobName, blobutil.BlobTier.StandardBlobTier.ARCHIVE, function (err, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, properties, resp) {
assert.equal(err, null);
assert.equal(properties.accessTier, blobutil.BlobTier.StandardBlobTier.ARCHIVE);
blobService.setBlobTier(containerName, blobName, blobutil.BlobTier.StandardBlobTier.HOT, function (err, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, properties, resp) {
assert.equal(err, null);
assert.equal(properties.accessTier, blobutil.BlobTier.StandardBlobTier.ARCHIVE);
assert.equal(properties.archiveStatus, rehydrate2hot);
blobService.setBlobTier(containerName, blobName, blobutil.BlobTier.StandardBlobTier.COOL, function (err, resp) {
assert.notEqual(err, null);
done();
});
});
});
});
});
});
runBlockBlobCase('setBlobTier should not work setting page block tiers for a block blob', function (done) {
blobService.setBlobTier(containerName, blobName, blobutil.BlobTier.PremiumPageBlobTier.P10, function (err, resp) {
assert.notEqual(err, null);
done();
});
});
}); // inner describe ends
describe('Archive tests for page blobs in a premium storage account', function () {
before(function (done) {
if (!runPageBlobSuite) {

10
typings/azure-storage/azure-storage.d.ts поставляемый
Просмотреть файл

@ -185,12 +185,12 @@ declare module azurestorage {
setServiceProperties(serviceProperties: common.models.ServicePropertiesResult.ServiceProperties, callback: ErrorOrResponse): void;
/**
* Sets the tier of a pageblob under a premium storage account.
* Sets the tier of a blockblob under a blob storage LRS account, or the tier of a pageblob under a premium storage account.
*
* @this {BlobService}
* @param {string} container The container name.
* @param {string} blob The blob name.
* @param {string} blobTier Please see BlobUtilities.BlobTier.PremiumPageBlobTier for possible values.
* @param {string} blobTier Please see BlobUtilities.BlobTier.StandardBlobTier or BlobUtilities.BlobTier.PremiumPageBlobTier for possible values.
* @param {LocationMode} [options.locationMode] Specifies the location mode used to decide which location the request should be sent to.
* Please see StorageUtilities.LocationMode for the possible values.
* @param {int} [options.timeoutIntervalInMs] The server timeout interval, in milliseconds, to use for the request.
@ -2881,6 +2881,7 @@ declare module azurestorage {
blobType: string;
accessTier?: string;
accessTierInferred?: boolean;
archiveStatus?: string;
isIncrementalCopy?: boolean;
requestId: string;
sequenceNumber?: string;
@ -3073,6 +3074,11 @@ declare module azurestorage {
P50: string;
P60: string;
};
StandardBlobTier: {
HOT: string;
COOL: string;
ARCHIVE: string;
};
}
};
}