public void Init(string dbName) { _dbName = dbName; string ctemp = "c:\\temp"; string path = String.Format("{0}\\{1}", ctemp, dbName); Directory.CreateDirectory(path); _env = new LMDBEnvironment(path); _env.MaxDatabases = 2; _env.MapSize = 10485760 * 100; _env.Open(); }
internal void Configure(LMDBEnvironment env) { if (_mapSize.HasValue) { env.MapSize = _mapSize.Value; } if (_maxDatabases.HasValue) { env.MaxDatabases = _maxDatabases.Value; } if (_maxReaders.HasValue) { env.MaxReaders = _maxReaders.Value; } }
/// <summary> /// Created new instance of LMDBTransaction /// </summary> /// <param name="environment">Environment.</param> /// <param name="parent">Parent transaction or null.</param> /// <param name="flags">Transaction open options.</param> internal LMDBTransaction(LMDBEnvironment environment, LMDBTransaction parent, TransactionBeginFlags flags) { if (environment == null) { throw new ArgumentNullException(nameof(environment)); } Environment = environment; ParentTransaction = parent; IsReadOnly = (flags & TransactionBeginFlags.ReadOnly) == TransactionBeginFlags.ReadOnly; State = TransactionState.Active; Environment.Disposing += Dispose; if (parent != null) { parent.Disposing += Dispose; parent.StateChanging += OnParentStateChanging; } var parentHandle = parent?.Handle() ?? IntPtr.Zero; Lmdb.mdb_txn_begin(environment.Handle(), parentHandle, flags, out _handle); _originalHandle = _handle; }