示例#1
0
        /// <summary>
        /// Complete transaction commit dirty pages and closing data file
        /// </summary>
        public void Complete(LiteTransaction trans)
        {
            lock (_activeTransactions)
            {
                popTopTransaction(trans);

                // check if trans are last transaction in stack
                if (_activeTransactions.Count > 0)
                {
                    return;
                }

                if (_cache.HasDirtyPages)
                {
                    // save dirty pages
                    this.Save();

                    // delete journal file - datafile is consist here
                    _disk.DeleteJournal();
                }

                // clear all pages in cache
                _cache.Clear();

                // close datafile
                _disk.Close();
            }
        }