示例#1
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        protected StorageManager()
        {
            this.activeContextMap   = new Dictionary <Transaction, StorageContext>();
            this.preparedContextMap = new StorageTransactionTable();
            this.pageManager        = new StoragePageManager();

            this.lockManager = new MyLM();

            this.disposed = false;
        }
示例#2
0
        private void InitializeDataFile()
        {
            // helpers
            List <int> oldPages = null;

            DBHdr dbRoot = new DBHdr();

            WriteDBRoot(dbRoot);

            // create the page table
            StoragePageTable pageTable = new StoragePageTable();

            dbRoot.PageTable = pageTable.WritePageTableData(
                this.dataFile, this.pageManager, out oldPages);

            // create resource index
            StorageIndex <RID> resourceIndx = new StorageIndex <RID>();

            dbRoot.ResourceIndex = resourceIndx.WriteIndexData(
                this.dataFile, this.pageManager, out oldPages);

            // create reservation index
            StorageIndex <Customer> reservationIndex = new StorageIndex <Customer>();

            dbRoot.ReservationIndex = reservationIndex.WriteIndexData(
                this.dataFile, this.pageManager, out oldPages);

            // create preped transactions index
            StorageTransactionTable preparedTransactions = new StorageTransactionTable();

            dbRoot.PrepedTransactions = preparedTransactions.WriteTransactionTableData(
                this.dataFile, this.pageManager, out oldPages);

            // write the page manager
            dbRoot.PageManager = this.pageManager.WritePageManagerData(this.dataFile);

            // write the dbRoot one more time
            WriteDBRoot(dbRoot);
        }