in src/DynamoDBSessionStateStore.cs [836:905]
private Table CreateTable()
{
CreateTableRequest createRequest = new CreateTableRequest
{
TableName = this._tableName,
KeySchema = new List<KeySchemaElement>
{
new KeySchemaElement
{
AttributeName = ATTRIBUTE_SESSION_ID, KeyType = "HASH"
}
},
AttributeDefinitions = new List<AttributeDefinition>
{
new AttributeDefinition
{
AttributeName = ATTRIBUTE_SESSION_ID, AttributeType = "S"
}
}
};
if (this._useOnDemandReadWriteCapacity)
{
createRequest.BillingMode = BillingMode.PAY_PER_REQUEST;
}
else
{
createRequest.ProvisionedThroughput = new ProvisionedThroughput
{
ReadCapacityUnits = this._initialReadUnits,
WriteCapacityUnits = this._initialWriteUnits
};
}
CreateTableResponse response = this._ddbClient.CreateTable(createRequest);
DescribeTableRequest descRequest = new DescribeTableRequest
{
TableName = this._tableName
};
// Wait till table is active
bool isActive = false;
while (!isActive)
{
Thread.Sleep(DESCRIBE_INTERVAL);
DescribeTableResponse descResponse = this._ddbClient.DescribeTable(descRequest);
string tableStatus = descResponse.Table.TableStatus;
if (string.Equals(tableStatus, ACTIVE_STATUS, StringComparison.InvariantCultureIgnoreCase))
isActive = true;
}
if (!string.IsNullOrEmpty(this._ttlAttributeName))
{
this._ddbClient.UpdateTimeToLive(new UpdateTimeToLiveRequest
{
TableName = this._tableName,
TimeToLiveSpecification = new TimeToLiveSpecification
{
AttributeName = this._ttlAttributeName,
Enabled = true
}
});
}
var tableConfig = CreateTableConfig();
Table table = Table.LoadTable(this._ddbClient, tableConfig);
return table;
}