Comparing version 1.9.5 to 1.9.6
@@ -263,6 +263,3 @@ /** | ||
/** | ||
* @param {Function} callback | ||
* @param {String} driver | ||
* @param {Number} tts | ||
* @returns {AbstractDriver} | ||
* @returns {AWS.DynamoDB} | ||
*/ | ||
@@ -355,2 +352,15 @@ | ||
}, { | ||
key: 'vogelsDynamoDriver', | ||
get: function get() { | ||
return _vogels2.default.dynamoDriver(); | ||
} | ||
/** | ||
* @param {Function} callback | ||
* @param {String} driver | ||
* @param {Number} tts | ||
* @returns {AbstractDriver} | ||
*/ | ||
}, { | ||
key: '_localDynamoDb', | ||
@@ -357,0 +367,0 @@ |
@@ -37,6 +37,7 @@ /** | ||
this._increasedFor = {}; | ||
this._initMaxSettings(); | ||
} | ||
/** | ||
* @returns {AWS.DynamoDB|AWS.DynamoDB.DocumentClient|*} | ||
* @private | ||
*/ | ||
@@ -46,2 +47,30 @@ | ||
_createClass(AutoScaleDynamoDB, [{ | ||
key: '_initMaxSettings', | ||
value: function _initMaxSettings() { | ||
let maxSettings = {}; | ||
let tablesNames = this._kernel.config.tablesNames; | ||
let modelsSettings = this._kernel.config.modelsSettings.reduce((obj, model) => Object.assign(obj, model), {}); | ||
for (let modelName in tablesNames) { | ||
if (!tablesNames.hasOwnProperty(modelName)) { | ||
continue; | ||
} | ||
let modelSettings = modelsSettings[modelName]; | ||
let tableName = tablesNames[modelName]; | ||
maxSettings[tableName] = { | ||
read: modelSettings.maxReadCapacity, | ||
write: modelSettings.maxWriteCapacity | ||
}; | ||
} | ||
this._maxSettings = maxSettings; | ||
} | ||
/** | ||
* @returns {AWS.DynamoDB|AWS.DynamoDB.DocumentClient|*} | ||
*/ | ||
}, { | ||
key: 'extend', | ||
@@ -110,3 +139,3 @@ value: function extend() { | ||
let increaseType = AutoScaleDynamoDB.increaseType(method); | ||
increasePayload[increaseType] = Math.ceil(parseInt(info.main[increaseType]) * AutoScaleDynamoDB.PROVISION_INCREASE_COEFFICIENT); | ||
increasePayload[increaseType] = this.increaseThroughput(parseInt(info.main[increaseType]), increaseType, table); | ||
@@ -149,8 +178,23 @@ throughput.setCapacity(increasePayload, error => { | ||
}, { | ||
key: 'dynamoDbDocumentClient', | ||
key: 'increaseThroughput', | ||
/** | ||
* @param {Number} iops | ||
* @param {String} type | ||
* @param {String} table | ||
* @returns {Number} | ||
*/ | ||
value: function increaseThroughput(iops, type, table) { | ||
let maxIops = this._maxSettings[table][type] || AutoScaleDynamoDB.MAX_THROUGHPUT; | ||
return Math.min(Math.ceil(iops * AutoScaleDynamoDB.PROVISION_INCREASE_COEFFICIENT), maxIops); | ||
} | ||
/** | ||
* @returns {AWS.DynamoDB|AWS.DynamoDB.DocumentClient|*} | ||
*/ | ||
}, { | ||
key: 'dynamoDbDocumentClient', | ||
get: function get() { | ||
@@ -251,2 +295,12 @@ return this._dynamoDbDocumentClient; | ||
/** | ||
* @returns {Number} | ||
*/ | ||
}, { | ||
key: 'MAX_THROUGHPUT', | ||
get: function get() { | ||
return 40000; | ||
} | ||
/** | ||
* @returns {String} | ||
@@ -253,0 +307,0 @@ */ |
{ | ||
"name": "deep-db", | ||
"version": "1.9.5", | ||
"version": "1.9.6", | ||
"description": "DEEP Database Library", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
81317
25
1751