Esempio n. 1
0
        /// <summary>
        /// Saves the table to disk
        /// </summary>
        /// <param name="Key"></param>
        public void FlushTable(string Key)
        {
            // #DEBUG# //
            this._Host.DebugPrint("TableStore.FlushTable({0})", Key);

            if (this.TableIsInMemory(Key))
            {
                Table t = this._TableStore[Key];
                TableStore.Flush(Key, t.Header);
                this._Host.DebugPrint("TableStore.FlushTable->Flushing table header({0})", Key);

                foreach (Page p in this.SelectPages(Key))
                {
                    TableStore.Flush(Key, p);
                    this._Host.DebugPrint("TableStore.FlushTable->Flushing page({0}:{1})", Key, p.PageID);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Flushes a page to disk
        /// </summary>
        /// <param name="ID"></param>
        public void FlushPage(PageUID ID)
        {
            // Check if the page is in memory //
            if (!this.PageIsInMemory(ID))
            {
                throw new ObjectNotInMemoryException(string.Format("Page ID '{0}' is not memory; critical code error", ID));
            }

            Page p = this._PageStore[ID];

            // Check the version, only flush if the page has been altered //
            if (p.Version > 0)
            {
                TableStore.Flush(ID.Key, p);

                // #DEBUG# //
                this._Host.DebugPrint("TableStore.FlushPage-> page flushed to disk({0})", ID.ToString());
            }
            else
            {
                // #DEBUG# //
                this._Host.DebugPrint("TableStore.FlushPage-> page unaltered; not flushed({0})", ID.ToString());
            }
        }