Ejemplo n.º 1
0
        /// <summary>
        /// Immediately attempts to upload reports from Temp Storage to the target <see cref="ReportStorageProvider" />.
        /// In case of failure, pending reports will be written back to temp storage.
        /// </summary>
        /// <param name="report">Report to be uploaded</param>
        /// <param name="provider">Non-Temporary Report Storage Provider</param>
        /// <param name="omitGlobals">Should Global Data Points be ommitted for saved reports? Defaults to false.</param>
        public async Task <Task> UploadAsync(TempStorageProvider tempProvider, ReportStorageProvider provider, bool omitGlobals = false)
        {
            var reports = await tempProvider.ReadAllDataAsync();

            PreProcessReport(reports, omitGlobals);
            try {
                return(provider.SaveToStorageAsync(reports));
            } catch (Exception) {
                return(tempProvider.WriteDataAsync(reports));
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Appends global data points to a set of reports and then saves the reports to the specified <see cref="TempStorageProvider"/>.
 /// </summary>
 /// <param name="reports">Set of reports to be added to the Temporary Storage Provider.</param>
 /// <param name="tempProvider">Temporary Report Storage Provider</param>
 /// <param name="omitGlobals">Should Global Data Points be ommitted for saved reports? Defaults to false.</param>
 public Task SaveToTempStorageAsync(List <TelemetryReport> reports, TempStorageProvider tempProvider, bool omitGlobals = false)
 {
     PreProcessReport(reports, omitGlobals, false);
     return(tempProvider.WriteDataAsync(reports));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Appends global data points to report and then saves the report to the specified <see cref="TempStorageProvider"/>.
 /// </summary>
 /// <param name="report">Report to be added to the Temporary Storage Provider.</param>
 /// <param name="tempProvider">Temporary Report Storage Provider</param>
 /// <param name="omitGlobals">Should Global Data Points be ommitted for saved reports? Defaults to false.</param>
 public Task SaveToTempStorageAsync(TelemetryReport report, TempStorageProvider tempProvider, bool omitGlobals = false)
 {
     PreProcessReport(report, omitGlobals);
     return(tempProvider.WriteDataAsync(report));
 }