public TransactionTests(SharedFileSystem fileSystem) { var path = fileSystem.CreateNewDirectoryForTest(); _env = new LightningEnvironment(path); _env.Open(); }
public void DatabaseDeleteShouldRemoveAllDuplicateDataItems() { var fs = new SharedFileSystem(); using (var env = new LightningEnvironment(fs.CreateNewDirectoryForTest(), configuration: new EnvironmentConfiguration { MapSize = 1024 * 1024, MaxDatabases = 1 })) { env.Open(); using (var tx = env.BeginTransaction()) using (var db = tx.OpenDatabase(configuration: new DatabaseConfiguration() { Flags = DatabaseOpenFlags.DuplicatesSort })) { var key = "key"; var value1 = "value1"; var value2 = "value2"; tx.Put(db, key, value1); tx.Put(db, key, value2); tx.Delete(db, key); Assert.False(tx.ContainsKey(db, key)); } } }
public MultiProcessTests(SharedFileSystem fileSystem) { var path = fileSystem.CreateNewDirectoryForTest(); _env = new LightningEnvironment(path); _env.Open(); }
public FinalizeTests(SharedFileSystem fileSystem) { var env = new LightningEnvironment(fileSystem.CreateNewDirectoryForTest()); env.Open(); var tx = env.BeginTransaction(); var db = tx.OpenDatabase(); tx.CreateCursor(db); }
public DatabaseIOTests(SharedFileSystem fileSystem) { var path = fileSystem.CreateNewDirectoryForTest(); _env = new LightningEnvironment(path); _env.MaxDatabases = 2; _env.Open(); _txn = _env.BeginTransaction(); _db = _txn.OpenDatabase(configuration: new DatabaseConfiguration { Flags = DatabaseOpenFlags.Create }); }
public void can_load_environment_from_multiple_processes() { var name = _fileSystem.CreateNewDirectoryForTest(); using var env = new LightningEnvironment(name); env.Open(); var otherProcessPath = Path.GetFullPath("../../../../SecondProcess/bin/Debug/netcoreapp3.0/SecondProcess.dll"); using var process = new Process { StartInfo = new ProcessStartInfo { FileName = "dotnet", Arguments = $"{otherProcessPath} {name}", RedirectStandardError = true, RedirectStandardInput = true, RedirectStandardOutput = true, UseShellExecute = false, CreateNoWindow = true, WorkingDirectory = Directory.GetCurrentDirectory() } }; var expected = "world"; using var tx = env.BeginTransaction(); using var db = tx.OpenDatabase(); tx.Put(db, Encoding.UTF8.GetBytes("hello"), Encoding.UTF8.GetBytes(expected)); tx.Commit(); var current = Process.GetCurrentProcess(); process.Start(); Assert.NotEqual(current.Id, process.Id); var result = process.StandardOutput.ReadLine(); process.WaitForExit(); Assert.Equal(expected, result); }
public EnvironmentTests(SharedFileSystem fileSystem) { _path = fileSystem.CreateNewDirectoryForTest(); _pathCopy = fileSystem.CreateNewDirectoryForTest(); }
public DatabaseTests(SharedFileSystem fileSystem) { var path = fileSystem.CreateNewDirectoryForTest(); _env = new LightningEnvironment(path); }
public ProfilingTests(SharedFileSystem fileSystem) { _env = new LightningEnvironment(fileSystem.CreateNewDirectoryForTest()); _env.MaxDatabases = 2; _env.Open(); }