Exemplo n.º 1
0
 void StartNewValueFile()
 {
     lock (_startNewValueFileLocker)
     {
         QuickFinishCompaction();
         var fileInfo = new FilePureValues(AllocNewFileGeneration());
         if (_cacheValueWriter != null)
         {
             lock (_cacheValueWriter)
             {
                 _cacheValueFile.HardFlush();
                 SetNewValueFile();
             }
         }
         else
         {
             SetNewValueFile();
         }
         fileInfo.WriteHeader(_cacheValueWriter);
         _fileInfos.TryAdd(_cacheValueFileId, fileInfo);
         _compactionCts = new CancellationTokenSource();
         _compactionTask = Task.Factory.StartNew(CompactionCore, _compactionCts.Token,
                                                 TaskCreationOptions.LongRunning, TaskScheduler.Default);
     }
 }