Deveel.Data.TableSourceComposite.Commit C# (CSharp) Method

Commit() private method

private Commit ( Transaction transaction, IList visibleTables, IEnumerable selectedFromTables, IEnumerable touchedTables, TransactionRegistry journal ) : void
transaction Deveel.Data.Transactions.Transaction
visibleTables IList
selectedFromTables IEnumerable
touchedTables IEnumerable
journal Deveel.Data.Transactions.TransactionRegistry
return void
        internal void Commit(Transaction transaction, IList<ITableSource> visibleTables,
						   IEnumerable<ITableSource> selectedFromTables,
						   IEnumerable<IMutableTable> touchedTables, TransactionRegistry journal)
        {
            var state = new TransactionWork(this, transaction, selectedFromTables, touchedTables, journal);

            // Exit early if nothing changed (this is a Read-only transaction)
            if (!state.HasChanges) {
                CloseTransaction(state.Transaction);
                return;
            }

            lock (commitLock) {
                var changedTablesList = state.Commit(objectStates);

                // Flush the journals up to the minimum commit id for all the tables
                // that this transaction changed.
                long minCommitId = Database.TransactionFactory.OpenTransactions.MinimumCommitId(null);
                foreach (var master in changedTablesList) {
                    master.MergeChanges(minCommitId);
                }
                int nsjsz = objectStates.Count;
                for (int i = nsjsz - 1; i >= 0; --i) {
                    var namespaceJournal = objectStates[i];
                    // Remove if the commit id for the journal is less than the minimum
                    // commit id
                    if (namespaceJournal.CommitId < minCommitId) {
                        objectStates.RemoveAt(i);
                    }
                }

                // Set a check point in the store system.  This means that the
                // persistance state is now stable.
                StoreSystem.SetCheckPoint();
            }
        }