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

CommitToTables() private method

private CommitToTables ( IEnumerable createdTables, IEnumerable droppedTables ) : void
createdTables IEnumerable
droppedTables IEnumerable
return void
        internal void CommitToTables(IEnumerable<int> createdTables, IEnumerable<int> droppedTables)
        {
            // Add created tables to the committed tables list.
            foreach (int createdTable in createdTables) {
                // For all created tables, add to the visible list and remove from the
                // delete list in the state store.
                var t = GetTableSource(createdTable);
                var resource = new TableStateStore.TableState(t.TableId, t.SourceName);
                StateStore.AddVisibleResource(resource);
                StateStore.RemoveDeleteResource(resource.SourceName);
            }

            // Remove dropped tables from the committed tables list.
            foreach (int droppedTable in droppedTables) {
                // For all dropped tables, add to the delete list and remove from the
                // visible list in the state store.
                var t = GetTableSource(droppedTable);
                var resource = new TableStateStore.TableState(t.TableId, t.SourceName);
                StateStore.AddDeleteResource(resource);
                StateStore.RemoveVisibleResource(resource.SourceName);
            }

            try {
                StateStore.Flush();
            } catch (IOException e) {
                throw new InvalidOperationException("IO Error: " + e.Message, e);
            }
        }