示例#1
0
        private void BreakChecksum(PageCursor cursor)
        {
            // Doesn't matter which bits we destroy actually. Destroying the first ones requires
            // no additional knowledge about where checksum is stored
            long existing = cursor.GetLong(cursor.Offset);

            cursor.PutLong(cursor.Offset, ~existing);
        }
示例#2
0
        public override long Get(long index)
        {
            long pageId = pageId(index);
            int  offset = offset(index);

            try
            {
                using (PageCursor cursor = PagedFile.io(pageId, PF_SHARED_READ_LOCK))
                {
                    cursor.Next();
                    long result;
                    do
                    {
                        result = cursor.GetLong(offset);
                    } while (cursor.ShouldRetry());
                    CheckBounds(cursor);
                    return(result);
                }
            }
            catch (IOException e)
            {
                throw new UncheckedIOException(e);
            }
        }