예제 #1
0
        public override void Update(RowHolder item, ushort position, ITransaction transaction)
        {
            transaction.VerifyLock(this.pageId, LockManager.LockTypeEnum.Exclusive);
            lock (this.lockObject)
            {
                RowHolder oldVal = new RowHolder(this.columnTypes);
                this.items.GetRow(position, ref oldVal);

                this.items.SetRow(position, item);

                ILogRecord rc = new UpdateRowRecord(this.pageId, (ushort)(position), diffOldValue: oldVal.Storage, diffNewValue: item.Storage, transaction.TranscationId(), this.columnTypes, this.PageType());
                transaction.AddRecord(rc);

                this.isDirty = true;
            }
        }
예제 #2
0
        public StringOnlyPage(uint pageSize, ulong pageId, ulong prevPageId, ulong nextPageId, ITransaction tran)
        {
            if (pageSize < IPage.FirstElementPosition + sizeof(ushort))
            {
                throw new ArgumentException("Size can't be less than size of char + sizeof(ushort) for length.");
            }

            this.pageSize   = pageSize;
            this.pageId     = pageId;
            this.prevPageId = prevPageId;
            this.nextPageId = nextPageId;
            this.items      = new char[this.MaxRowCount()];

            ILogRecord logRecord = new AllocatePageLogRecord(pageId, tran.TranscationId(), global::PageManager.PageType.StringPage, pageSize, nextPageId, prevPageId, null);

            tran.AddRecord(logRecord);

            this.isDirty = true;
        }
예제 #3
0
        public override int Insert(RowHolder item, ITransaction transaction)
        {
            transaction.VerifyLock(this.pageId, LockManager.LockTypeEnum.Exclusive);

            lock (this.lockObject)
            {
                int position = this.items.InsertRow(item);

                if (position == -1)
                {
                    return(position);
                }

                this.rowCount++;

                ILogRecord rc = new InsertRowRecord(this.pageId, (ushort)(position), item.Storage, transaction.TranscationId(), this.columnTypes, this.PageType());
                transaction.AddRecord(rc);

                this.isDirty = true;

                return(position);
            }
        }
예제 #4
0
        public MixedPage(uint pageSize, ulong pageId, ColumnInfo[] columnTypes, ulong prevPageId, ulong nextPageId, Memory <byte> memory, ulong bufferPoolToken, ITransaction tran)
        {
            if (columnTypes == null || columnTypes.Length == 0)
            {
                throw new ArgumentException("Column type definition can't be null or empty");
            }

            this.pageSize = pageSize;
            this.pageId   = pageId;

            this.columnTypes     = columnTypes;
            this.prevPageId      = prevPageId;
            this.nextPageId      = nextPageId;
            this.inMemoryStorage = memory;
            this.bufferPoolToken = bufferPoolToken;
            this.items           = new RowsetHolder(this.columnTypes, this.inMemoryStorage, init: true);

            ILogRecord logRecord = new AllocatePageLogRecord(pageId, tran.TranscationId(), global::PageManager.PageType.MixedPage, pageSize, nextPageId, prevPageId, columnTypes);

            tran.AddRecord(logRecord);

            this.isDirty = true;
        }