Пример #1
0
        public void Destroy()
        {
            Database.Dispose();
            Database = null;

            LDB.Destroy(DatabasePath);
        }
Пример #2
0
 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");
     });
 }
Пример #3
0
        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);
        }
Пример #4
0
        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();
        }
Пример #5
0
        private WeakReference _parent;  // as DB

        internal Snapshot(IntPtr handle, LDB parent)
        {
            _handle = handle;
            _parent = new WeakReference(parent);
        }
Пример #6
0
        public void Repair()
        {
            Database.Dispose();

            LDB.Repair(DatabasePath);
        }