Пример #1
0
 void UpdateTransactionLogInBTreeRoot(IBTreeRootNode btreeRoot)
 {
     if (btreeRoot.TrLogFileId != _fileIdWithTransactionLog && btreeRoot.TrLogFileId != 0)
     {
         _compactorScheduler?.AdviceRunning();
     }
     btreeRoot.TrLogFileId = _fileIdWithTransactionLog;
     if (_writerWithTransactionLog != null)
     {
         btreeRoot.TrLogOffset = (uint)_writerWithTransactionLog.GetCurrentPosition();
     }
     else
     {
         btreeRoot.TrLogOffset = 0;
     }
 }
Пример #2
0
 public KeyValueDB(IFileCollection fileCollection, ICompressionStrategy compression, uint fileSplitSize, ICompactorScheduler compactorScheduler)
 {
     if (fileCollection == null)
     {
         throw new ArgumentNullException(nameof(fileCollection));
     }
     if (compression == null)
     {
         throw new ArgumentNullException(nameof(compression));
     }
     if (fileSplitSize < 1024 || fileSplitSize > int.MaxValue)
     {
         throw new ArgumentOutOfRangeException(nameof(fileSplitSize), "Allowed range 1024 - 2G");
     }
     _compactorScheduler = compactorScheduler;
     MaxTrLogFileSize    = fileSplitSize;
     _compression        = compression;
     DurableTransactions = false;
     _fileCollection     = new FileCollectionWithFileInfos(fileCollection);
     _lastCommited       = new BTreeRoot(0);
     LoadInfoAboutFiles();
     _compactFunc = _compactorScheduler?.AddCompactAction(Compact);
     _compactorScheduler?.AdviceRunning();
 }