public CloudTable GetTable(string suffix) { var table = LegacyTableReader.TryGetLegacy(_tableClient, suffix); if (table != null) { return(table); } var tableName = _tableNamePrefix + suffix; table = _tableClient.GetTableReference(tableName); return(table); }
public async Task <Segment <IFunctionDefinition> > GetFunctionDefinitionsAsync(string continuationToken) { var instanceTable = _tableLookup.GetTableForDateTime(TimeBucket.CommonEpoch); var results = await GetFunctionDefinitionsHelperAsync(instanceTable); var legacyTable = LegacyTableReader.GetLegacyTable(_tableLookup); if (legacyTable != null) { var olderResults = await GetFunctionDefinitionsHelperAsync(legacyTable); results = LegacyTableReader.Merge(results, olderResults); } var segment = new Segment <IFunctionDefinition>(results); return(segment); }
// List all tables that we may have handed out. public async Task <CloudTable[]> ListTablesAsync() { List <CloudTable> list = new List <CloudTable>(); TableContinuationToken continuationToken = null; do { var segment = await _tableClient.ListTablesSegmentedAsync(_tableNamePrefix, continuationToken, CancellationToken.None); list.AddRange(segment.Results); continuationToken = segment.ContinuationToken; }while (continuationToken != null); var legacyTable = LegacyTableReader.GetLegacyTable(_tableClient); if (legacyTable != null) { list.Add(legacyTable); } return(list.ToArray()); }
// The 'epoch' is a mapping from DateTime onto integers that preserves ordering. // For example, if we have a table query between Start and End datetimes, we need to determine // the subset of tables that can possible hold that date range. // Use integers instead of datetime because: // - It provides a sortable view of the date ranges. // - integers are valid Azure Table characters, so they can easily be a table suffix. public static long GetEpochNumberFromTable(CloudTable table) { long epoch; epoch = LegacyTableReader.GetEpochFromTable(table); if (epoch > 0) { return(epoch); } string tableName = table.Name; if (tableName.Length < 5) { return(-1); } string suffix = tableName.Substring(tableName.Length - 6, 6); if (long.TryParse(suffix, out epoch)) { return(epoch); } return(-1); }