예제 #1
0
파일: DB.cs 프로젝트: uxwine/leveldb.net
        /// <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);
        }
예제 #2
0
파일: DB.cs 프로젝트: vtchain/LevelDb.Net
        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));
        }
예제 #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
        }
예제 #4
0
파일: DB.cs 프로젝트: 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));
        }