public FileSetFactory( IStartupLog startUpLog, IPagePoolFactory pagePoolFactory) { _startUpLog = startUpLog; _pagePoolFactory = pagePoolFactory; }
public void Setup() { _startUpLog = SetupMock <IStartupLog>(); _errorLog = SetupMock <IErrorLog>(); _pagePoolFactory = SetupMock <IPagePoolFactory>(); _pagePool = _pagePoolFactory.Create(_pageSize); _dataFileInfo = new FileInfo("C:\\temp\\test.mdf"); _dataFile = new DataFile(_dataFileInfo, _pageSize, _startUpLog); _logFileInfo = new FileInfo("C:\\temp\\test.ldf"); _logFile = new LogFile(_logFileInfo, true, _startUpLog); _fileSet = new FileSet( new[] { _dataFile }, new[] { _logFile }, _pagePoolFactory, _startUpLog); var databaseFactory = SetupMock <IDatabaseFactory>(); _database = databaseFactory.Open(null); var pageCache = new PageCache(_fileSet, _database, _pagePoolFactory, _startUpLog, _errorLog); _pageStore = new PageStore(pageCache, _startUpLog); _accessorFactory = new AccessorFactory(); _accessor = _accessorFactory.SmallSequentialAccessor(_pageStore); }
public void Setup() { _startupLog = SetupMock <IStartupLog>(); _errorLog = SetupMock <IErrorLog>(); _pagePoolFactory = SetupMock <IPagePoolFactory>(); _pagePool = _pagePoolFactory.Create(_pageSize); _logFileInfo1 = new FileInfo("C:\\temp\\test1.ldf"); _logFileInfo2 = new FileInfo("C:\\temp\\test2.ldf"); _dataFileInfo1 = new FileInfo("C:\\temp\\test1.mdf"); _dataFileInfo2 = new FileInfo("C:\\temp\\test2.mdf"); _fileSet = new FileSet( new IDataFile[] { new DataFile(_dataFileInfo1, _pageSize, _startupLog), new DataFile(_dataFileInfo2, _pageSize, _startupLog) }, new ILogFile[] { new LogFile(_logFileInfo1, true, _startupLog), new LogFile(_logFileInfo2, true, _startupLog) }, _pagePoolFactory, _startupLog); var databaseFactory = SetupMock <IDatabaseFactory>(); _database = databaseFactory.Open(null); var pageCache = new PageCache(_fileSet, _database, _pagePoolFactory, _startupLog, _errorLog); _pageStore = new PageStore(pageCache, _startupLog); }
public PageCacheFactory( IPagePoolFactory pagePoolFactory, IStartupLog startUpLog, IErrorLog errorLog) { _pagePoolFactory = pagePoolFactory; _startUpLog = startUpLog; _errorLog = errorLog; }
public void SetUp() { _startUpLog = SetupMock <IStartupLog>(); _pagePoolFactory = SetupMock <IPagePoolFactory>(); _pagePool = _pagePoolFactory.Create(_pageSize); _logFileInfo1 = new FileInfo("C:\\temp\\test1.ldf"); _logFileInfo2 = new FileInfo("C:\\temp\\test2.ldf"); _logFileInfo3 = new FileInfo("C:\\temp\\test3.ldf"); _dataFileInfo1 = new FileInfo("C:\\temp\\test1.mdf"); _dataFileInfo2 = new FileInfo("C:\\temp\\test2.mdf"); _dataFileInfo3 = new FileInfo("C:\\temp\\test3.mdf"); }
public FileSet( IEnumerable <IDataFile> dataFiles, IEnumerable <ILogFile> logFiles, IPagePoolFactory pagePoolFactory, IStartupLog startUpLog) { _startUpLog = startUpLog; _dataFiles = dataFiles.ToArray(); _logFiles = logFiles.ToArray(); startUpLog.WriteLine("Opening a file set with " + _dataFiles.Length + " data files and " + _logFiles.Length + " log files", _dataFiles.Length < 1 || _logFiles.Length < 1); if (_dataFiles.Length < 1) { throw new FileLayerException("You must have at least 1 data file"); } if (_logFiles.Length < 1) { throw new FileLayerException("You must have at least 1 log file"); } foreach (var dataFile in _dataFiles) { startUpLog.WriteLine("- " + dataFile); } foreach (var logFile in _logFiles) { startUpLog.WriteLine("- " + logFile); } _pageSize = _dataFiles[0].PageSize; if (_dataFiles.Any(df => df.PageSize != _pageSize)) { startUpLog.WriteLine("Data files can not be mixed, these files are not a file set", true); throw new FileLayerException("All of the data files must have the same page size"); } if (_dataFiles.Length > 64) { startUpLog.WriteLine("You can not have more than 64 data files in a file set", true); throw new FileLayerException("The maximum number of data files is 64"); } _pagePool = pagePoolFactory.Create(_pageSize); _transactions = new Dictionary <ITransaction, TransactionDetail>(); }
public PageCache( IFileSet fileSet, IDatabase database, IPagePoolFactory pagePoolFactory, IStartupLog startupLog, IErrorLog errorLog) { _startupLog = startupLog; _errorLog = errorLog; _fileSet = fileSet; _database = database; startupLog.WriteLine("Creating a new page cache for " + _fileSet); _pagePool = pagePoolFactory.Create(fileSet.PageSize); _pages = new PageHeadCollection(fileSet, startupLog, errorLog, _pagePool); _versions = new VersionHeadCollection(startupLog, errorLog, database); _transactions = new TransactionHeadCollection(startupLog, errorLog, _pagePool); }