public void Destroy() { Database.Dispose(); Database = null; LDB.Destroy(DatabasePath); }
public void Error() { Assert.Throws <LevelDBException>(() => { var options = new Options() { CreateIfMissing = false }; var db = new LDB("non-existent", options); Assert.True(false); db.Get("key1"); }); }
public DBTests() { var tempPath = Path.GetTempPath(); var randName = Path.GetRandomFileName(); DatabasePath = Path.Combine(tempPath, randName); var options = new Options() { CreateIfMissing = true }; Database = new LDB(DatabasePath, options); }
public void Cache() { Database.Dispose(); // open the DB with a cache that is not owned by LevelDB, then // close DB and then free the cache var options = new Options() { CacheSize = 64 }; Database = new LDB(DatabasePath, options); options = null; GC.Collect(); GC.WaitForPendingFinalizers(); Database.Set("key1", "value1"); Database.Dispose(); Database = null; GC.Collect(); GC.WaitForPendingFinalizers(); }
private WeakReference _parent; // as DB internal Snapshot(IntPtr handle, LDB parent) { _handle = handle; _parent = new WeakReference(parent); }
public void Repair() { Database.Dispose(); LDB.Repair(DatabasePath); }