public void Smoke_test() { IDbConfig config = new DbConfig(); DbOnTheRocks db = new SimpleRocksDb("blocks", GetRocksDbSettings("blocks", "Blocks"), config); db[new byte[] { 1, 2, 3 }] = new byte[] { 4, 5, 6 }; Assert.AreEqual(new byte[] { 4, 5, 6 }, db[new byte[] { 1, 2, 3 }]); }
public void Can_get_all_on_empty() { IDbConfig config = new DbConfig(); DbOnTheRocks db = new SimpleRocksDb("testIterator", GetRocksDbSettings("testIterator", "TestIterator"), config); try { db.GetAll().ToList(); } finally { db.Clear(); db.Dispose(); } }
public async Task Dispose_while_writing_does_not_cause_access_violation_exception() { IDbConfig config = new DbConfig(); DbOnTheRocks db = new SimpleRocksDb("testDispose1", GetRocksDbSettings("testDispose1", "TestDispose1"), config); Task task = new Task(() => { while (true) { db.Set(Keccak.Zero, new byte[] { 1, 2, 3 }); } }); task.Start(); await Task.Delay(100); db.Dispose(); await Task.Delay(100); task.Dispose(); }