public StorageEnvironment(StorageEnvironmentOptions options) { try { _log = LoggingSource.Instance.GetLogger <StorageEnvironment>(options.BasePath); _options = options; _dataPager = options.DataPager; _freeSpaceHandling = new FreeSpaceHandling(); _headerAccessor = new HeaderAccessor(this); _options.DeleteAllTempBuffers(); _decompressionBuffers = new DecompressionBuffersPool(options); var isNew = _headerAccessor.Initialize(); _scratchBufferPool = new ScratchBufferPool(this); if (PlatformDetails.RunningOnPosix && options.BasePath != null && IsStorageSupportingO_Direct(options.BasePath) == false) { options.SafePosixOpenFlags &= ~PerPlatformValues.OpenFlags.O_DIRECT; var message = "Path " + options.BasePath + " not supporting O_DIRECT writes. As a result - data durability is not guarenteed"; _options.InvokeNonDurabaleFileSystemError(this, message, null); } options.PosixOpenFlags = options.SafePosixOpenFlags; _journal = new WriteAheadJournal(this); if (isNew) { CreateNewDatabase(); } else // existing db, let us load it { LoadExistingDatabase(); } if (_options.ManualFlushing == false) { Task.Run(IdleFlushTimer); } } catch (Exception) { Dispose(); throw; } }