internal AzureFileTrimmer( string sourceFolderName, string workFolder, StorageAccountFactory storageAccountFactory, string containerName, TimeSpan blobDeletionAge, string fabricNodeInstanceName, string deploymentId, bool azureInterfaceAvailable) { // Initialization this.stopping = false; this.sourceFolderName = sourceFolderName; this.localMap = Path.Combine(workFolder, AzureBlobUploader.LocalMapFolder); this.traceSource = new FabricEvents.ExtensionsEvents(FabricEvents.Tasks.FabricDCA); this.logSourceId = string.Concat(TraceType, "-", Guid.NewGuid().ToString("P")); this.storageAccountFactory = storageAccountFactory; this.containerName = containerName; this.fabricNodeInstanceName = fabricNodeInstanceName; this.blobDeletionAge = blobDeletionAge; this.deploymentId = deploymentId; this.azureInterfaceAvailable = azureInterfaceAvailable; this.localMapTrimmingHelper = new LocalMapTrimmingHelper(sourceFolderName); this.folderTrimmer = new FolderTrimmer( this.traceSource, this.logSourceId, blobDeletionAge); this.perfHelper = new AzureBlobPerformance(this.traceSource, this.logSourceId); // Deletion and query are currently synchronous, so the concurrency // count is 1. this.perfHelper.ExternalOperationInitialize( ExternalOperationTime.ExternalOperationType.BlobQuery, 1); this.perfHelper.ExternalOperationInitialize( ExternalOperationTime.ExternalOperationType.BlobDeletion, 1); // Create a timer to delete old logs string timerId = string.Concat( this.logSourceId, OldLogDeletionTimerIdSuffix); var oldLogDeletionInterval = (this.blobDeletionAge < TimeSpan.FromDays(1)) ? AzureConstants.OldLogDeletionIntervalForTest : AzureConstants.OldLogDeletionInterval; this.oldLogDeletionTimer = new DcaTimer( timerId, this.DeleteOldLogsHandler, oldLogDeletionInterval); this.oldLogDeletionTimer.Start(); }
internal FileShareTrimmer( string folderName, string destinationPath, FolderTrimmer.DestinationOperationPerformer destinationOperationPerformer, string localMap, TimeSpan fileDeletionAge) { // Initialization this.traceSource = new FabricEvents.ExtensionsEvents(FabricEvents.Tasks.FabricDCA); this.logSourceId = string.Concat(TraceType, "-", Guid.NewGuid().ToString("P")); this.destinationPath = destinationPath; this.destinationOperationPerformer = destinationOperationPerformer; this.localMap = localMap; this.localMapTrimmingHelper = new LocalMapTrimmingHelper(folderName); this.folderTrimmer = new FolderTrimmer( this.traceSource, this.logSourceId, fileDeletionAge); this.perfHelper = new FileSharePerformance(this.traceSource, this.logSourceId); // File deletion is done one at a time, so the // concurrency count is 1. this.perfHelper.ExternalOperationInitialize( ExternalOperationTime.ExternalOperationType.FileShareDeletion, 1); // Create a timer to delete old logs string timerId = string.Concat( this.logSourceId, OldLogDeletionTimerIdSuffix); var oldLogDeletionInterval = (fileDeletionAge < TimeSpan.FromDays(1)) ? FileShareUploaderConstants.OldLogDeletionIntervalForTest : FileShareUploaderConstants.OldLogDeletionInterval; this.oldLogDeletionTimer = new DcaTimer( timerId, this.DeleteOldFilesHandler, oldLogDeletionInterval); this.oldLogDeletionTimer.Start(); }