Example #1
0
 public Task <IStorage <V> > CreateStorage <V>()
 {
     lock (_storageMap)
     {
         var transactionId = System.Threading.Interlocked.Increment(ref _opId);
         _lastTableTransaction = transactionId;
         var tableType = typeof(V);
         var storage   = new FileStorage <V>(_nextTableId, _folder);
         _storageMap.Add(tableType, storage);
         _storageIdMap.Add(tableType, _nextTableId);
         _nextTableId++;
         return
             (_journal.WriteJournalEntry(JournalEntryType.CreateTable,
                                         System.Text.Encoding.UTF8.GetBytes(tableType.ToString()), transactionId)
              .ContinueWith(_ => (IStorage <V>)storage));
     }
 }