in common.js [130:225]
function createTables(dynamoDB, callback) {
// processed files table spec
var pfKey = 'loadFile';
var processedFilesSpec = {
AttributeDefinitions: [{
AttributeName: pfKey,
AttributeType: 'S'
}],
KeySchema: [{
AttributeName: pfKey,
KeyType: 'HASH'
}],
TableName: filesTable,
ProvisionedThroughput: {
ReadCapacityUnits: 1,
WriteCapacityUnits: 5
}
};
var configKey = s3prefix;
var configSpec = {
AttributeDefinitions: [{
AttributeName: configKey,
AttributeType: 'S'
}],
KeySchema: [{
AttributeName: configKey,
KeyType: 'HASH'
}],
TableName: configTable,
ProvisionedThroughput: {
ReadCapacityUnits: 1,
WriteCapacityUnits: 5
}
};
var batchKey = batchId;
var inputLoc = s3prefix;
var batchSpec = {
AttributeDefinitions: [{
AttributeName: batchKey,
AttributeType: 'S'
}, {
AttributeName: 'status',
AttributeType: 'S'
}, {
AttributeName: lastUpdate,
AttributeType: 'N'
}, {
AttributeName: inputLoc,
AttributeType: 'S'
}],
KeySchema: [{
AttributeName: inputLoc,
KeyType: 'HASH'
}, {
AttributeName: batchKey,
KeyType: 'RANGE'
}],
TableName: batchTable,
ProvisionedThroughput: {
ReadCapacityUnits: 1,
WriteCapacityUnits: 5
},
GlobalSecondaryIndexes: [{
IndexName: batchStatusGSI,
KeySchema: [{
AttributeName: 'status',
KeyType: 'HASH'
}, {
AttributeName: lastUpdate,
KeyType: 'RANGE'
}],
Projection: {
ProjectionType: 'ALL'
},
ProvisionedThroughput: {
ReadCapacityUnits: 1,
WriteCapacityUnits: 5
}
}]
};
let functions = [
createTableAndWait.bind(undefined, processedFilesSpec, dynamoDB),
createTableAndWait.bind(undefined, batchSpec, dynamoDB),
createTableAndWait.bind(undefined, configSpec, dynamoDB)
];
async.waterfall(functions, function (err, results) {
if (err) {
logger.error(err);
callback(err);
} else {
callback();
}
});
};