예제 #1
0
        protected override void ReadContent(ByteReader reader)
        {
            this.Nodes = new Dictionary<ushort, IndexNode>(this.ItemCount);

            for (var i = 0; i < this.ItemCount; i++)
            {
                var index = reader.ReadUInt16();
                var levels = reader.ReadByte();

                var node = new IndexNode(levels);

                node.Page = this;
                node.Position = new PageAddress(this.PageID, index);
                node.KeyLength = reader.ReadUInt16();
                node.Key = reader.ReadBsonValue(node.KeyLength);
                node.DataBlock = reader.ReadPageAddress();

                for (var j = 0; j < node.Prev.Length; j++)
                {
                    node.Prev[j] = reader.ReadPageAddress();
                    node.Next[j] = reader.ReadPageAddress();
                }

                this.Nodes.Add(node.Position.Index, node);
            }
        }
예제 #2
0
        protected override void ReadContent(ByteReader reader)
        {
            Nodes = new Dictionary <ushort, IndexNode>(ItemCount);

            for (var i = 0; i < ItemCount; i++)
            {
                var index  = reader.ReadUInt16();
                var levels = reader.ReadByte();

                var node = new IndexNode(levels);

                node.Page      = this;
                node.Position  = new PageAddress(PageID, index);
                node.KeyLength = reader.ReadUInt16();
                node.Key       = reader.ReadBsonValue(node.KeyLength);
                node.DataBlock = reader.ReadPageAddress();

                for (var j = 0; j < node.Prev.Length; j++)
                {
                    node.Prev[j] = reader.ReadPageAddress();
                    node.Next[j] = reader.ReadPageAddress();
                }

                Nodes.Add(node.Position.Index, node);
            }
        }
        protected override void ReadContent(ByteReader reader)
        {
            this.CollectionName = reader.ReadString();
            this.DocumentCount  = reader.ReadInt64();
            this.FreeDataPageID = reader.ReadUInt32();

            foreach (var index in this.Indexes)
            {
                var field = reader.ReadString();
                var eq    = field.IndexOf('=');

                // Use same string to avoid change file defition
                if (eq > 0)
                {
                    index.Field      = field.Substring(0, eq);
                    index.Expression = field.Substring(eq + 1);
                }
                else
                {
                    index.Field      = field;
                    index.Expression = "$." + field;
                }

                index.Unique          = reader.ReadBoolean();
                index.HeadNode        = reader.ReadPageAddress();
                index.TailNode        = reader.ReadPageAddress();
                index.FreeIndexPageID = reader.ReadUInt32();
            }

            // position on page-footer (avoid file structure change)
            reader.Position = BasePage.PAGE_SIZE - 8;
            this.Sequence   = reader.ReadInt64();
        }
예제 #4
0
        protected override void ReadContent(ByteReader reader)
        {
            this.CollectionName = reader.ReadString();
            this.DocumentCount  = reader.ReadInt64();
            this.FreeDataPageID = reader.ReadUInt32();

            foreach (var index in this.Indexes)
            {
                index.Field           = reader.ReadString();
                index.Unique          = reader.ReadBoolean();
                index.HeadNode        = reader.ReadPageAddress();
                index.TailNode        = reader.ReadPageAddress();
                index.FreeIndexPageID = reader.ReadUInt32();
            }
        }
예제 #5
0
        protected override void ReadContent(ByteReader reader)
        {
            this.CollectionName = reader.ReadString();
            this.FreeDataPageID = reader.ReadUInt32();
            this.DocumentCount  = reader.ReadUInt32();

            foreach (var index in this.Indexes)
            {
                index.Field                     = reader.ReadString();
                index.HeadNode                  = reader.ReadPageAddress();
                index.TailNode                  = reader.ReadPageAddress();
                index.FreeIndexPageID           = reader.ReadUInt32();
                index.Options.Unique            = reader.ReadBoolean();
                index.Options.IgnoreCase        = reader.ReadBoolean();
                index.Options.TrimWhitespace    = reader.ReadBoolean();
                index.Options.EmptyStringToNull = reader.ReadBoolean();
                index.Options.RemoveAccents     = reader.ReadBoolean();
            }
        }
예제 #6
0
        protected override void ReadContent(ByteReader reader)
        {
            this.CollectionName = reader.ReadString();
            this.FreeDataPageID = reader.ReadUInt32();
            this.DocumentCount = reader.ReadUInt32();

            foreach (var index in this.Indexes)
            {
                index.Field = reader.ReadString();
                index.HeadNode = reader.ReadPageAddress();
                index.TailNode = reader.ReadPageAddress();
                index.FreeIndexPageID = reader.ReadUInt32();
                index.Options.Unique = reader.ReadBoolean();
                index.Options.IgnoreCase = reader.ReadBoolean();
                index.Options.TrimWhitespace = reader.ReadBoolean();
                index.Options.EmptyStringToNull = reader.ReadBoolean();
                index.Options.RemoveAccents = reader.ReadBoolean();
            }
        }
예제 #7
0
        protected override void ReadContent(ByteReader reader)
        {
            this.CollectionName = reader.ReadString();
            this.FreeDataPageID = reader.ReadUInt32();
            var uintCount = reader.ReadUInt32(); // read as uint (4 bytes)

            foreach (var index in this.Indexes)
            {
                index.Field                     = reader.ReadString();
                index.HeadNode                  = reader.ReadPageAddress();
                index.TailNode                  = reader.ReadPageAddress();
                index.FreeIndexPageID           = reader.ReadUInt32();
                index.Options.Unique            = reader.ReadBoolean();
                index.Options.IgnoreCase        = reader.ReadBoolean();
                index.Options.TrimWhitespace    = reader.ReadBoolean();
                index.Options.EmptyStringToNull = reader.ReadBoolean();
                index.Options.RemoveAccents     = reader.ReadBoolean();
            }

            // be compatible with v2_beta
            var longCount = reader.ReadInt64();

            this.DocumentCount = Math.Max(uintCount, longCount);
        }
예제 #8
0
        protected override void ReadContent(ByteReader reader)
        {
            this.CollectionName = reader.ReadString();
            this.FreeDataPageID = reader.ReadUInt32();
            var uintCount = reader.ReadUInt32(); // read as uint (4 bytes)

            foreach (var index in this.Indexes)
            {
                index.Field = reader.ReadString();
                index.HeadNode = reader.ReadPageAddress();
                index.TailNode = reader.ReadPageAddress();
                index.FreeIndexPageID = reader.ReadUInt32();
                index.Options.Unique = reader.ReadBoolean();
                index.Options.IgnoreCase = reader.ReadBoolean();
                index.Options.TrimWhitespace = reader.ReadBoolean();
                index.Options.EmptyStringToNull = reader.ReadBoolean();
                index.Options.RemoveAccents = reader.ReadBoolean();
            }

            // be compatible with v2_beta
            var longCount = reader.ReadInt64();
            this.DocumentCount = Math.Max(uintCount, longCount);

        }
예제 #9
0
        protected override void ReadContent(ByteReader reader)
        {
            this.DataBlocks = new Dictionary <ushort, DataBlock>(ItemCount);

            for (var i = 0; i < ItemCount; i++)
            {
                var block = new DataBlock();

                block.Page         = this;
                block.Position     = new PageAddress(this.PageID, reader.ReadUInt16());
                block.ExtendPageID = reader.ReadUInt32();

                for (var j = 0; j < CollectionIndex.INDEX_PER_COLLECTION; j++)
                {
                    block.IndexRef[j] = reader.ReadPageAddress();
                }

                var size = reader.ReadUInt16();
                block.Data = reader.ReadBytes(size);

                this.DataBlocks.Add(block.Position.Index, block);
            }
        }
예제 #10
0
        protected override void ReadContent(ByteReader reader)
        {
            this.DataBlocks = new Dictionary<ushort, DataBlock>(ItemCount);

            for (var i = 0; i < ItemCount; i++)
            {
                var block = new DataBlock();

                block.Page = this;
                block.Position = new PageAddress(this.PageID, reader.ReadUInt16());
                block.ExtendPageID = reader.ReadUInt32();

                for (var j = 0; j < CollectionIndex.INDEX_PER_COLLECTION; j++)
                {
                    block.IndexRef[j] = reader.ReadPageAddress();
                }

                var size = reader.ReadUInt16();
                block.Data = reader.ReadBytes(size);

                this.DataBlocks.Add(block.Position.Index, block);
            }
        }
예제 #11
0
        protected override void ReadContent(ByteReader reader)
        {
            this.CollectionName = reader.ReadString();
            this.DocumentCount = reader.ReadInt64();
            this.FreeDataPageID = reader.ReadUInt32();

            foreach (var index in this.Indexes)
            {
                index.Field = reader.ReadString();
                index.Unique = reader.ReadBoolean();
                index.HeadNode = reader.ReadPageAddress();
                index.TailNode = reader.ReadPageAddress();
                index.FreeIndexPageID = reader.ReadUInt32();
            }
        }