public Transaction(StorageEnvironment env, long id, TransactionFlags flags, IFreeSpaceHandling freeSpaceHandling) { _dataPager = env.Options.DataPager; _env = env; _journal = env.Journal; _id = id; _freeSpaceHandling = freeSpaceHandling; Flags = flags; var scratchPagerState = env.ScratchBufferPool.PagerState; scratchPagerState.AddRef(); _pagerStates.Add(scratchPagerState); if (flags.HasFlag(TransactionFlags.ReadWrite) == false) { // for read transactions, we need to keep the pager state frozen // for write transactions, we can use the current one (which == null) _scratchPagerState = scratchPagerState; _state = env.State.Clone(this); _journal.GetSnapshots().ForEach(AddJournalSnapshot); return; } _state = env.State.Clone(this); InitTransactionHeader(); MarkTreesForWriteTransaction(); }
public StorageEnvironment(StorageEnvironmentOptions options) { try { _options = options; _dataPager = options.DataPager; _freeSpaceHandling = new FreeSpaceHandling(); _headerAccessor = new HeaderAccessor(this); var isNew = _headerAccessor.Initialize(); _scratchBufferPool = new ScratchBufferPool(this); _journal = new WriteAheadJournal(this); if (isNew) CreateNewDatabase(); else // existing db, let us load it LoadExistingDatabase(); State.FreeSpaceRoot.Name = Constants.FreeSpaceTreeName; State.Root.Name = Constants.RootTreeName; Writer = new TransactionMergingWriter(this, _cancellationTokenSource.Token); if (_options.ManualFlushing == false) _flushingTask = FlushWritesToDataFileAsync(); } catch (Exception) { Dispose(); throw; } }
public JournalApplicator(WriteAheadJournal waj) { _waj = waj; }
public JournalApplicator(WriteAheadJournal waj) { _waj = waj; }
public JournalApplicator(WriteAheadJournal waj, ReaderWriterLockSlim flushingSemaphore) { _waj = waj; _flushingSemaphore = flushingSemaphore; }
public JournalApplicator(WriteAheadJournal waj, ReaderWriterLockSlim flushingSemaphore = null) { _waj = waj; _flushingSemaphore = flushingSemaphore ?? new ReaderWriterLockSlim(); }
public JournalShipper(WriteAheadJournal waj, ReaderWriterLockSlim shippingSemaphore = null) { _waj = waj; _shippingSemaphore = shippingSemaphore ?? new ReaderWriterLockSlim(); }
public JournalApplicator(WriteAheadJournal waj, ReaderWriterLockSlim flushingSemaphore) { _waj = waj; _flushingSemaphore = flushingSemaphore; }