internal TableSource CopySourceTable(TableSource tableSource, IIndexSet indexSet)
{
lock (commitLock) {
try {
// The unique id that identifies this table,
int tableId = NextTableId();
var sourceName = tableSource.SourceName;
// Create the object.
var masterTable = new TableSource(this, StoreSystem, LargeObjectStore, tableId, sourceName);
masterTable.CopyFrom(tableId, tableSource, indexSet);
// Add to the list of all tables.
tableSources.Add(tableId, masterTable);
// Add this to the list of deleted tables,
MarkUncommitted(tableId);
// Commit this
StateStore.Flush();
// And return it.
return masterTable;
} catch (IOException e) {
throw new Exception(String.Format("Unable to copy source table '{0}' because of an error.", tableSource.TableInfo.TableName), e);
}
}
}