public void TestBlockManipulatorSaveConfigException() { using (var b = new BlockManipulator(_randomTestFile, 1024, 2048)) { b.SaveConfig(null); } }
public void TestBlockManipulatorLockBlockException() { using (var b = new BlockManipulator(_randomTestFile, 1024, 2048)) { b.LockBlock(0); b.LockBlock(0); } }
// NOTE: long parameter smell. Are they all needed? If yes: refactoring "introduce parameter object". public BlockList(IIndexNode node, BlockAllocation blockAllocation, FileSystemOptions options, BlockParser blockParser, BlockManipulator blockManipulator, Persistence persistence) { _node = node; _blockAllocation = blockAllocation; _options = options; _blockParser = blockParser; _blockManipulator = blockManipulator; _persistence = persistence; }
public VFSFileStream(VFSFile file, BlockParser blockParser, FileSystemOptions options, BlockAllocation blockAllocation, BlockManipulator blockManipulator, Persistence.Persistence persistence) { _file = file; _blockParser = blockParser; _options = options; _blockAllocation = blockAllocation; _blockManipulator = blockManipulator; _persistence = persistence; _writeBuffer = new byte[_options.BlockSize]; }
internal FileSystem(FileSystemOptions options) { _options = options; _blockManipulator = new BlockManipulator(_options.Location, _options.BlockSize, _options.MasterBlockSize); _blockParser = new BlockParser(_options); _persistence = new Persistence.Persistence(_blockParser, _blockManipulator); _blockAllocation = _options.BlockAllocation; InitializeFileSystem(); }
private BlockManipulator GetBlockManipulator(int id) { var options = Persistence.LoadDiskOptions(id); var path = DiskLocation(id); if (!File.Exists(path)) File.WriteAllText(path, ""); var b = new BlockManipulator(path, options.BlockSize, options.MasterBlockSize); return b; }
public Persistence(BlockParser blockParser, BlockManipulator blockManipulator) { _blockParser = blockParser; _blockManipulator = blockManipulator; }
private void Dispose(bool disposing) { // If you need thread safety, use a lock around these // operations, as well as in your methods that use the resource. if (!disposing) return; _disposed = true; // free managed resources if (_blockManipulator != null) { WriteConfig(); _blockManipulator.Dispose(); _blockManipulator = null; } if (_readWriteLock != null) { _readWriteLock.Dispose(); _readWriteLock = null; } }