예제 #1
0
 public MigrationStorages(IDynamicStorage <TKey, TEntry> dynamic, IVolumeStorage <TKey, TEntry> volume, DateTime?from, DateTime?to)
 {
     Dynamic = dynamic;
     Volume  = volume;
     From    = from;
     To      = to;
 }
예제 #2
0
 public DynamicStorageLookupResult(IDynamicStorage <TKey, TEntry> storage, DateTime?from, DateTime?to) : base(storage, from, to)
 {
 }
예제 #3
0
 public DynamicStorageLookupResult(IDynamicStorage <TKey, TEntry> storage)
     : base(storage)
 {
 }
예제 #4
0
        private async Task <IEnumerable <ISerie <TKey, TEntry> > > WriteToDynamicStorageAsync(IDynamicStorage <TKey, TEntry> storage, IEnumerable <ISerie <TKey, TEntry> > series, bool useTemporaryStorageOnFailure)
        {
            var sw = Stopwatch.StartNew();

            try
            {
                await storage.WriteAsync(series).ConfigureAwait(false);

                _logger.Info($"Wrote {series.Sum( x => x.GetEntries().Count )} to dynamic storage. Elapsed = {sw.ElapsedMilliseconds} ms.");
                return(series);
            }
            catch (Exception e1)
            {
                if (useTemporaryStorageOnFailure)
                {
                    if (_temporaryStorage == null)
                    {
                        throw new InvalidOperationException("No temporary storage has been provided.");
                    }

                    try
                    {
                        _temporaryStorage.WriteAsync(series);
                    }
                    catch (Exception e2)
                    {
                        _logger.Error(e2, $"An error ocurred while writing to temporary storage after failing to write to dynamic storage. Elapsed = {sw.ElapsedMilliseconds} ms.");
                    }
                }

                _logger.Error(e1, $"An error ocurred while writing to dynamic storage. Elapsed = {sw.ElapsedMilliseconds} ms.");

                return(_series);
            }
        }
예제 #5
0
 public static Task DeleteAsync <TKey, TEntry>(this IDynamicStorage <TKey, TEntry> storage, TKey id, DateTime to)
     where TEntry : IEntry
 {
     return(storage.DeleteAsync(new[] { id }, to));
 }