Example #1
0
        /// <summary>
        /// Open the database with the specified "name".
        /// Options should not be modified after calling this method.
        /// </summary>
        public DB(string name, Options options)
        {
            Options = options ?? new Options();
            IntPtr error;

            Handle = LevelDBInterop.leveldb_open(Options.Handle, name, out error);
            LevelDBException.Check(error);
            GC.KeepAlive(Options);
        }
Example #2
0
        public static DB Open(string name, Options options)
        {
            IntPtr error;

            IntPtr handle = LevelDBInterop.leveldb_open(options.Handle, name, out error);

            LevelDBException.Check(error);
            return(new DB(handle));
        }
Example #3
0
        /// <summary> Open the database with the specified "name". Options should not be modified after calling this method. </summary>
        /// <param name="name">The name (subfolder) of the database</param>
        /// <param name="options">Options should not be modified after calling this method.</param>
        public DB(String name, Options options)
        {
            this._Options = options ?? new Options();
            this.Handle   = LevelDBInterop.leveldb_open(this._Options.Handle, name, out IntPtr error);
            LevelDBException.Check(error);
            GC.KeepAlive(this._Options);

#if DEBUG
            System.Diagnostics.Debug.WriteLine("Opened leveldb: " + name);
#endif
        }
Example #4
0
File: DB.cs Project: bkwcl/LevelDB
        /// <summary>
        /// Open the database with the specified "name".
        /// </summary>
        public DB(Options options, string name)
        {
            IntPtr error;

            this._Cache      = options.Cache;
            this._InfoLog    = options.InfoLog;
            this._Comparator = options.Comparator;
            this.Handle      = LevelDBInterop.leveldb_open(options.Handle, name, out error);


            Throw(error, msg => new UnauthorizedAccessException(msg));
        }