function createTenantProductTable()

in Lab4/server/layers/nodejs/partition-manager.js [69:118]


function createTenantProductTable(tenantId, tableName, model, callback) {
    console.log('Creating Product Table, table Name: ' + tableName);

    let tableDefinition;
    if(model == MODEL_POOL){
        tableDefinition = {
            AttributeDefinitions: [ {
            AttributeName: "TenantId", 
            AttributeType: "S"
            },
            {
            AttributeName: "ProductId", 
            AttributeType: "S"
            } ], 
            KeySchema: [ {
            AttributeName: "TenantId", 
            KeyType: "HASH"
            },
            {
            AttributeName: "ProductId", 
            KeyType: "RANGE"
            } ], 
            ProvisionedThroughput: {
            ReadCapacityUnits: 5, 
            WriteCapacityUnits: 5
            }, 
            TableName: tableName + "-Pooled"
        };
    }
    else  if (model == MODEL_SILO){
        tableDefinition = {
            AttributeDefinitions: [ {
              AttributeName: "ProductId", 
              AttributeType: "S"
            } ], 
            KeySchema: [ {
              AttributeName: "ProductId", 
              KeyType: "HASH"
            } ], 
            ProvisionedThroughput: {
             ReadCapacityUnits: 5, 
             WriteCapacityUnits: 5
            }, 
            TableName: tableName + "-Silo-" + tenantId
        };
    }
    helper.createTable(tableDefinition, function() {
        callback(tableDefinition.TableName);
    });
}