public void TestContinousAllocation() { var b = new BlockAllocation(); Assert.AreEqual(2, b.Allocate()); Assert.AreEqual(3, b.Allocate()); Assert.AreEqual(4, b.Allocate()); Assert.AreEqual(5, b.Allocate()); Assert.AreEqual(6, b.Allocate()); Assert.AreEqual(7, b.Allocate()); }
// 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(); }
public FileSystemOptions(string location, StreamEncryptionType encryption, StreamCompressionType compression) { Location = location; Encryption = encryption; Compression = compression; BlockSize = (int)MathUtil.KB(8); MasterBlockSize = (int)MathUtil.KB(32); NameLength = 255; BlockReferenceSize = 64; BlockAllocation = new BlockAllocation(); IndirectionCountForIndirectNodes = 2; RootBlockNr = 0; }
public void TestSerializeAndDeserialize() { using (var m = new MemoryStream()) { var b1 = new BlockAllocation(); Assert.AreEqual(2, b1.Allocate()); Assert.AreEqual(3, b1.Allocate()); Assert.AreEqual(4, b1.Allocate()); Assert.AreEqual(5, b1.Allocate()); IFormatter formatter = new BinaryFormatter(); formatter.Serialize(m, b1); m.Seek(0, SeekOrigin.Begin); var b2 = BlockAllocation.Deserialize(m); Assert.AreEqual(6, b2.Allocate()); Assert.AreEqual(7, b2.Allocate()); Assert.AreEqual(8, b2.Allocate()); } }
public void Reload(FileSystemOptions newOptions) { newOptions.ApplyEncryptionSettings(_options); _options = newOptions; _blockAllocation = _options.BlockAllocation; // TODO: reload indexing service // SearchService.StartIndexing(_searchService, this); Root = LatestRoot = ImportRootFolder(); }