public FileWheel( IFileSource dfs, Action <uint, Hash, BlockAddress> onDeletion) { _onDeletion = onDeletion ?? throw new ArgumentNullException(nameof(onDeletion)); _fs = dfs ?? throw new ArgumentNullException(nameof(dfs)); _readFiles = new BlockFile[dfs.Count]; // Discover any on-disk files. foreach (var(i, mmap) in dfs.ScanExistingFiles()) { if (i >= 2) { _readFiles[i] = new BlockFile(mmap, (uint)(i + 1)); } else { mmap.Dispose(); } } // The first two files are always reserved for the first two writers. ReplaceFile(0); ReplaceFile(1); _nextAlloc = 2; }