Beispiel #1
0
        /// <summary>
        /// Change password from all data stream
        /// </summary>
        public void ChangePassword(string password, EngineSettings settings)
        {
            if (settings.Password == password)
            {
                return;
            }

            // empty data file
            this.SetLength(0, FileOrigin.Data);

            // close all streams
            _dataPool.Dispose();

            // delete data file
            _dataFactory.Delete();

            settings.Password = password;

            // new datafile will be created with new password
            _dataFactory = settings.CreateDataFactory();

            // create stream pool
            _dataPool = new StreamPool(_dataFactory, false);

            // get initial data file length
            _dataLength = -PAGE_SIZE;
        }
Beispiel #2
0
        public void Dispose()
        {
            // dispose queue (wait finish)
            if (_queue.IsValueCreated)
            {
                _queue.Value.Dispose();
            }

            // get stream length from writer - is safe because only this instance
            // can change file size
            var delete = _logFactory.Exists() && _logPool.Writer.Length == 0;

            // dispose Stream pools
            _dataPool.Dispose();
            _logPool.Dispose();

            if (delete)
            {
                _logFactory.Delete();
            }

            // other disposes
            _cache.Dispose();

            ENSURE(_dataFactory.IsLocked() == false, "datafile must be released");
            ENSURE(_dataFactory.IsLocked() == false, "logfile must be released");
        }
Beispiel #3
0
        public void Dispose()
        {
            if (_pool.IsValueCreated)
            {
                _pool.Value.Dispose();
            }

            _factory.Delete();
        }
Beispiel #4
0
        public void Dispose()
        {
            _pool.Dispose();

            _factory.Delete();
        }