Skip to content

Commit

Permalink
Merge pull request #6 from veena-udayabhanu/master
Browse files Browse the repository at this point in the history
Storage Client Library - 0.2.1
  • Loading branch information
vinaysh-msft committed Jul 2, 2014
2 parents ee626b6 + 678cfb6 commit ee3e226
Show file tree
Hide file tree
Showing 71 changed files with 266 additions and 518 deletions.
3 changes: 0 additions & 3 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@
# Node #
node_modules/

# Test folder #
test/

# Examples #
examples/blobuploader/
8 changes: 8 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
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 CTP v1 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.

2014.07.01 Version 0.2.1

ALL
* Fixed a bug with casing which caused the module to fail on linux machines.

BLOB
* Fixed a bug which failed to upload an empty blob for empty block blob files uploaded using createBlockBlobFromFile when retry policies were used.

2014.06.16 Version 0.2.0

ALL
Expand Down
10 changes: 5 additions & 5 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ module.exports = function(grunt) {
src: [
"README.md",
"lib/azure-storage.js",
"lib/common/lib/services/filters/retrypolicyfilter.js",
"lib/common/lib/services/filters/linearretrypolicyfilter.js",
"lib/common/lib/services/filters/exponentialretrypolicyfilter.js",
"lib/common/lib/services/storageutilities.js",
"lib/common/lib/util/date.js",
"lib/common/filters/retrypolicyfilter.js",
"lib/common/filters/linearretrypolicyfilter.js",
"lib/common/filters/exponentialretrypolicyfilter.js",
"lib/common/services/storageutilities.js",
"lib/common/util/date.js",
"lib/services/blob/blobservice.js",
"lib/services/blob/blobutilities.js",
"lib/services/queue/queueservice.js",
Expand Down
13 changes: 1 addition & 12 deletions lib/azure-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ exports.createQueueServiceWithSas = function(hostUri, sasToken) {
* For example, HTTP status codes and headers.
*/

var azureCommon = require('./common/lib/common');
var azureCommon = require('./common/common');

exports.Constants = azureCommon.Constants;
exports.StorageUtilities = azureCommon.StorageUtilities;
Expand All @@ -183,19 +183,8 @@ exports.SR = azureCommon.SR;
exports.StorageServiceClient = azureCommon.StorageServiceClient;
exports.Logger = azureCommon.Logger;
exports.WebResource = azureCommon.WebResource;
exports.Validate = azureCommon.validate;
exports.date = azureCommon.date;

exports.ServiceSettings = azureCommon.ServiceSettings;
exports.StorageServiceSettings = azureCommon.StorageServiceSettings;

exports.AclResult = require('./common/lib/services/aclresult');

// Credentials
exports.SharedAccessSignature = require('./common/lib/services/sharedaccesssignature');
exports.SharedKey = require('./common/lib/services/sharedkey');
exports.SharedKeyTable = require('./services/table/internal/sharedkeytable');

// Other filters
exports.LinearRetryPolicyFilter = azureCommon.LinearRetryPolicyFilter;
exports.ExponentialRetryPolicyFilter = azureCommon.ExponentialRetryPolicyFilter;
Expand Down
46 changes: 26 additions & 20 deletions lib/common/lib/common.js → lib/common/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,39 @@ if (nodeVersion.major === 0 && nodeVersion.minor > 8 && !(nodeVersion.minor > 10
exports.xmlbuilder = require('xmlbuilder');
exports.xml2js = require('xml2js');

exports.Constants = require('./util/constants');
exports.SR = require('./util/sr');
exports.Logger = require('./diagnostics/logger');
exports.date = require('./util/date');

exports.WebResource = require('./http/webresource');

// Services
exports.StorageServiceClient = require('./services/storageserviceclient');

exports.ServiceSettings = require('./services/servicesettings');
exports.StorageServiceSettings = require('./services/storageservicesettings');
exports.StorageUtilities = require('./services/StorageUtilities');
// Models
exports.ServicePropertiesResult = require('./models/servicepropertiesresult');
exports.ServiceStatsParser = require('./models/servicestatsparser');
exports.AclResult = require('./models/aclresult');

exports.ServicePropertiesResult = require('./services/servicepropertiesresult');
exports.ServiceStatsParser = require('./services/servicestatsparser');
// Filters
exports.LinearRetryPolicyFilter = require('./filters/linearretrypolicyfilter');
exports.ExponentialRetryPolicyFilter = require('./filters/exponentialretrypolicyfilter');
exports.RetryPolicyFilter = require('./filters/retrypolicyfilter');

// Other filters
exports.LinearRetryPolicyFilter = require('./services/filters/linearretrypolicyfilter');
exports.ExponentialRetryPolicyFilter = require('./services/filters/exponentialretrypolicyfilter');
exports.RetryPolicyFilter = require('./services/filters/retrypolicyfilter');
// Signing
exports.SharedAccessSignature = require('./signing/sharedaccesssignature');
exports.SharedKey = require('./signing/sharedkey');

exports.HmacSha256Sign = require('./services/hmacsha256sign');
exports.ISO8061Date = require('./util/iso8061date');
// Streams
exports.BatchOperation = require('./streams/batchoperation');
exports.ChunkAllocator = require('./streams/chunkallocator');
exports.ChunkStream = require('./streams/chunkstream');
exports.ChunkStreamWithStream = require('./streams/chunkstreamwithstream');
exports.FileReadStream = require('./streams/filereadstream');
exports.SpeedSummary = require('./streams/speedsummary');

// Utilities
exports.Constants = require('./util/constants');
exports.SR = require('./util/sr');
exports.date = require('./util/date');
exports.ISO8061Date = require('./util/iso8061date');
exports.util = require('./util/util');
exports.validate = require('./util/validate');
exports.SR = require('./util/sr');
exports.AclResult = require('./services/aclresult');

exports.SharedAccessSignature = require('./services/sharedaccesssignature');
exports.SharedKey = require('./services/sharedkey');
exports.StorageUtilities = require('./util/storageutilities');
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
// limitations under the License.
//

var azureutil = require('../../util/util');
var Constants = require('../../util/constants');
var StorageUtilities = require('../../services/StorageUtilities');
var azureutil = require('../util/util');
var Constants = require('../util/constants');
var StorageUtilities = require('../util/storageutilities');
var extend = require('util')._extend;

/**
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,22 @@

// Module dependencies.
var _ = require('underscore');
var xmlbuilder = require('xmlbuilder');

var azureCommon = require('./../common');
var xmlbuilder = azureCommon.xmlbuilder;
var azureutil = azureCommon.util;
var Constants = azureCommon.Constants;
var azureutil = require('../util/util');
var ISO8061Date = require('../util/iso8061date');
var Constants = require('../util/constants');
var AclConstants = Constants.AclConstants;
var ISO8061Date = azureCommon.ISO8061Date;

function AclResult(signedIdentifiers) {
if (signedIdentifiers) {
this.signedIdentifiers = signedIdentifiers;
}
}
exports = module.exports;

/**
* Builds an XML representation for container acl permissions.
*
* @param {array} entity The signed identifiers.
* @return {string} The XML container acl permissions.
*/
AclResult.serialize = function (signedIdentifiersJs) {
exports.serialize = function (signedIdentifiersJs) {
var doc = xmlbuilder.create();
doc = doc.begin(AclConstants.SIGNED_IDENTIFIERS_ELEMENT, { version: '1.0', encoding: 'utf-8' });

Expand Down Expand Up @@ -93,7 +88,7 @@ AclResult.serialize = function (signedIdentifiersJs) {
return doc.doc().toString();
};

AclResult.parse = function (signedIdentifiersXml) {
exports.parse = function (signedIdentifiersXml) {
var signedIdentifiers = [];

signedIdentifiersXml = azureutil.tryGetValueChain(signedIdentifiersXml, [ 'SignedIdentifiers', 'SignedIdentifier' ]);
Expand Down Expand Up @@ -126,6 +121,4 @@ AclResult.parse = function (signedIdentifiersXml) {
}

return signedIdentifiers;
};

module.exports = AclResult;
};
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ var WebResource = require('../http/webresource');
var ServiceSettings = require('./servicesettings');
var StorageServiceSettings = require('./storageservicesettings');
var Constants = require('../util/constants');
var StorageUtilities = require('./storageutilities');
var StorageUtilities = require('../util/storageutilities');

var SharedKey = require('./sharedkey');
var SharedAccessSignature = require('./sharedaccesssignature');
var SharedKey = require('../signing/sharedkey');
var SharedAccessSignature = require('../signing/sharedaccesssignature');

var HeaderConstants = Constants.HeaderConstants;
var QueryStringConstants = Constants.QueryStringConstants;
Expand All @@ -46,7 +46,7 @@ var defaultRequestLocationMode = Constants.RequestLocationMode.PRIMARY_ONLY;

var Logger = require('../diagnostics/logger');

var moduleVersion = require('../../../../package.json').version;
var moduleVersion = require('../../../package.json').version;

/**
* Creates a new StorageServiceClient object.
Expand Down Expand Up @@ -374,18 +374,23 @@ StorageServiceClient.prototype._performRequest = function (webResource, body, op

var sendStream = function () {
// NOTE: workaround for an unexpected EPIPE exception when piping streams larger than 29 MB
if (finalRequestOptions.headers['content-length'] && finalRequestOptions.headers['content-length'] < 29 * 1024 * 1024) {
if (!azureutil.objectIsNull(finalRequestOptions.headers['content-length']) && finalRequestOptions.headers['content-length'] < 29 * 1024 * 1024) {
body.outputStream.pipe(buildRequest());
} else {
sendUnchunked();
}
};

if (!body.outputStream.readable) {
// This will wait until we know the readable stream is actually valid before piping
body.outputStream.on('open', function () {
sendStream();
});
// if the content length is zero, build the request and don't send a body
if (finalRequestOptions.headers['content-length'] === 0) {
buildRequest();
} else {
// otherwise, wait until we know the readable stream is actually valid before piping
body.outputStream.on('open', function () {
sendStream();
});
}
} else {
sendStream();
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ var https = require('https');
var EventEmitter = require('events').EventEmitter;
var os = require('os');

var azureCommon = require('./../../../common/lib/common');
var utils = azureCommon.util;
var Logger = azureCommon.Logger;
var azureutil = require('../util/util');
var Logger = require('../diagnostics/logger');
var Constants = require('../util/constants');

var DEFAULT_OPERATION_MEMORY_USAGE = azureCommon.Constants.BlobConstants.DEFAULT_WRITE_BLOCK_SIZE_IN_BYTES;
var DEFAULT_OPERATION_MEMORY_USAGE = Constants.BlobConstants.DEFAULT_WRITE_BLOCK_SIZE_IN_BYTES;
var DEFAULT_GLOBAL_CONCURRENCY = 5; //Default http connection limitation for nodejs

var SystemTotalMemory = os.totalmem();
var nodeVersion = utils.getNodeVersion();
var nodeVersion = azureutil.getNodeVersion();
var enableReuseSocket = nodeVersion.major >= 0 && nodeVersion.minor >= 10;

/**
Expand Down Expand Up @@ -342,7 +342,7 @@ function RestOperation(serviceClient, operation) {
this._userCallback = arguments[arguments.length - 1];
this._callbackArguments = null;
var sliceEnd = arguments.length;
if(utils.objectIsFunction(this._userCallback)) {
if(azureutil.objectIsFunction(this._userCallback)) {
sliceEnd--;
} else {
this._userCallback = null;
Expand Down Expand Up @@ -380,7 +380,7 @@ function CommonOperation(operationFunc, callback) {
this.operationId = -1;
this._callbackArguments = null;
var sliceStart = 2;
if(utils.objectIsFunction(callback)) {
if(azureutil.objectIsFunction(callback)) {
this._userCallback = callback;
} else {
this._userCallback = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//


/**
* Chunked memory pool allocator.
* It could dramatically reduce the memory usage.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@

var stream = require('stream');
var crypto = require('crypto');

var azureCommon = require('./../../../common/lib/common');
var Constants = azureCommon.Constants;

var util = require('util');

var Constants = require('../util/constants');
var bufferSize = Constants.BlobConstants.DEFAULT_WRITE_BLOCK_SIZE_IN_BYTES;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// limitations under the License.
//

var ChunkStream = require('./chunkStream');
var ChunkStream = require('./chunkstream');
var EventEmitter = require('events').EventEmitter;
var util = require('util');

Expand All @@ -29,9 +29,9 @@ var util = require('util');
function ChunkStreamWithStream(stream, options) {
ChunkStream.call(this, options);

stream.pause(); // Pause stream and wait for data listener. It's useful for node v0.6 and v0.8
stream.pause(); // Pause stream and wait for data listener. It's useful for node v0.8
this._stream = stream;
this._stream.on('end', this.end.bind(this)); // Should catch the end event for node v0.6 and v0.8
this._stream.on('end', this.end.bind(this)); // Should catch the end event for node v0.8
}

util.inherits(ChunkStreamWithStream, ChunkStream);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
var fs = require('fs');
var util = require('util');

var azureCommon = require('./../../../common/lib/common');
var Constants = azureCommon.Constants;
var Constants = require('../util/constants');
var bufferSize = Constants.BlobConstants.DEFAULT_WRITE_BLOCK_SIZE_IN_BYTES;

var EventEmitter = require('events').EventEmitter;
var bufferSize = Constants.BlobConstants.DEFAULT_WRITE_BLOCK_SIZE_IN_BYTES;

/**
* File read stream
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
//

var util = require('util');

var azureCommon = require('./../../../common/lib/common');
var azureutil = azureCommon.util;
var azureutil = require('../util/util');

/**
* Blob upload/download speed summary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var Constants = {
/*
* Specifies the value to use for UserAgent header.
*/
USER_AGENT_PRODUCT_VERSION: '0.9',
USER_AGENT_PRODUCT_VERSION: '0.2.1',

/**
* Constant representing a kilobyte (Non-SI version).
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit ee3e226

Please sign in to comment.