コード例 #1
0
        /// <summary>
        /// Deletes all the Azure tables
        /// </summary>
        /// <param name="azureTableStorageConnectionString">connection string to azure table storage</param>
        /// <returns>delete task</returns>
        private static async Task DeleteAzureTables(string azureTableStorageConnectionString)
        {
            Console.WriteLine("Deleting all tables from Azure Table Store...");

            // Get azure table storage with the give connection string
            AzureTableStorage azureTableStorage = new AzureTableStorage(azureTableStorageConnectionString);

            // Get CTStore using only azure table storage
            CTStore store = new CTStore(azureTableStorage, null);

            // Enumerate all the containers defined
            foreach (ContainerIdentifier containerIdentifier in Enum.GetValues(typeof(ContainerIdentifier)))
            {
                if (!ContainerTableDescriptorProvider.Containers.ContainsKey(containerIdentifier))
                {
                    Console.WriteLine("  " + containerIdentifier.ToString() + " - Descriptor not found");
                    continue;
                }

                // delete each table container
                await store.DeleteContainerAsync(containerIdentifier.ToString());

                Console.WriteLine("  " + containerIdentifier.ToString() + " - Table Container Deleted");
            }

            // clean up the StoreVersion container because it has no descriptor
            await store.DeleteContainerAsync(ContainerIdentifier.ServiceConfig.ToString());

            Console.WriteLine("  " + ContainerIdentifier.ServiceConfig.ToString() + " - Table Container Deleted");
        }
コード例 #2
0
        /// <summary>
        /// deletes WAD* tables: WADCrashDump, WADDiagnosticsInfrastructureLogsTable, WADDirectoriesTable, WADLogsTable,
        /// WADPerformanceCountersTable, WADWindowsEventLogsTable
        /// </summary>
        /// <param name="azureBlobStorageConnectionString">connection string to azure blob storage</param>
        /// <returns>delete task</returns>
        private static async Task DeleteAzureLogs(string azureBlobStorageConnectionString)
        {
            AzureTableStorage azureLogsStorage = new AzureTableStorage(azureBlobStorageConnectionString);
            CTStore           store            = new CTStore(azureLogsStorage, null);

            // Delete tables one at a time (could be parallelized)
            foreach (var containerName in WADTableNames)
            {
                Console.WriteLine("Deleting " + containerName + " tables from Azure Blob Store...");
                await store.DeleteContainerAsync(containerName);

                Console.WriteLine("  " + containerName + " - Container Deleted");
            }
        }