Пример #1
0
        /// <summary>
        /// Shutdown process:
        /// - Stop any new transaction
        /// - Stop operation loops over database (throw in SafePoint)
        /// - Wait for writer queue
        /// - Close disks
        /// </summary>
        protected virtual void Dispose(bool disposing)
        {
            // this method can be called from Ctor, so many
            // of this members can be null yet (even if are readonly).
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                // stop running all transactions
                _monitor?.Dispose();

                // do a soft checkpoint (only if exclusive lock is possible)
                if (_settings.Checkpoint > 0)
                {
                    _walIndex?.Checkpoint(true);
                }

                // close all disk streams (and delete log if empty)
                _disk?.Dispose();

                // delete sort temp file
                _sortDisk?.Dispose();

                // dispose lockers
                _locker?.Dispose();
            }

            _disposed = true;
        }
Пример #2
0
        /// <summary>
        /// Shutdown process:
        /// - [[[[DESCRIBE]]]]
        /// </summary>
        public async ValueTask DisposeAsync()
        {
            // this method can be called from Ctor, so many
            // of this members can be null yet (even if are readonly).
            if (_disposed)
            {
                return;
            }

            _disposed = true;

            // do a soft checkpoint (only if exclusive lock is possible)
            if (_header?.Pragmas.Checkpoint > 0)
            {
                await _walIndex?.Checkpoint();
            }

            // close all disk streams (and delete log if empty)
            _disk?.Dispose();

            // dispose lockers
            _locker.Dispose();

            LOG("engine disposed", "ENGINE");
        }
Пример #3
0
        /// <summary>
        /// Run checkpoint command to copy log file into data file
        /// </summary>
        public Task <int> CheckpointAsync()
        {
            if (_disposed == true)
            {
                throw LiteException.DatabaseClosed();
            }

            return(_walIndex.Checkpoint());
        }
Пример #4
0
 /// <summary>
 /// Run checkpoint command to copy log file into data file
 /// </summary>
 public void Checkpoint() => _walIndex.Checkpoint(false);
Пример #5
0
 /// <summary>
 /// Run checkpoint command to copy log file into data file
 /// </summary>
 public int Checkpoint() => _walIndex.Checkpoint(false, true);
Пример #6
0
 /// <summary>
 /// Run checkpoint command to copy log file into data file
 /// </summary>
 public int Checkpoint() => _walIndex.Checkpoint();