public async Task<Storage> NewStorageAsync(StorageOptions storageOptions = null, FileSystem fileSystem = null) { if (storageOptions == null) storageOptions = new StorageOptions(); string name = string.Format("TestStorage-{0}-{1}", DateTime.Now.ToString("yyyy-MM-dd,HH-mm-ss"), Guid.NewGuid()); var storage = new Storage(new StorageState(name, storageOptions) { FileSystem = fileSystem ?? new InMemoryFileSystem(name) }); await storage.InitAsync(); storages.Add(storage); return storage; }
public async Task DbIteratorShouldWorkCorrectlyAfterCompaction() { using (var storage = new Storage(Guid.NewGuid().ToString(), new StorageOptions())) { await storage.InitAsync(); await this.DoWrite(storage, 10000, true); await storage.Commands.CompactMemTableAsync(); var iterator = storage.Reader.NewIterator(new ReadOptions()); iterator.SeekToFirst(); int i = 0; while (iterator.IsValid) { i++; iterator.Next(); } Assert.Equal(10000, i); } }