Example #1
0
        public void AddData(RawDataSection section, bool includeDetails)
        {
            var allocatedSpaceInBytes = section.Size;

            AllocatedSpaceInBytes += allocatedSpaceInBytes;
            DataSizeInBytes       += allocatedSpaceInBytes;

            if (includeDetails)
            {
                UsedSizeInBytes += (long)(allocatedSpaceInBytes * section.Density);
            }
        }
Example #2
0
        public void AddData(RawDataSection section, bool calculateExactSizes)
        {
            var allocatedSpaceInBytes = section.Size;

            AllocatedSpaceInBytes += allocatedSpaceInBytes;
            DataSizeInBytes       += allocatedSpaceInBytes;

            if (calculateExactSizes)
            {
                UsedSizeInBytes += (long)(allocatedSpaceInBytes * section.Density);
            }
        }
Example #3
0
        public byte *DirectRead(long id, out int size)
        {
            var posInPage = id % _pageSize;

            if (posInPage == 0) // large
            {
                var page = _tx.LowLevelTransaction.GetPage(id / _pageSize);
                size = page.OverflowSize;

                return(page.Pointer + sizeof(PageHeader));
            }

            // here we rely on the fact that RawDataSmallSection can
            // read any RawDataSmallSection piece of data, not just something that
            // it exists in its own section, but anything from other sections as well
            return(RawDataSection.DirectRead(_tx.LowLevelTransaction, id, out size));
        }
Example #4
0
        public TableReport GetReport(bool calculateExactSizes)
        {
            var overflowSize = _overflowPageCount * _pageSize;
            var report       = new TableReport(overflowSize, overflowSize, calculateExactSizes)
            {
                Name            = Name.ToString(),
                NumberOfEntries = NumberOfEntries
            };

            report.AddStructure(_tableTree, calculateExactSizes);

            if (_schema.Key != null && _schema.Key.IsGlobal == false)
            {
                var pkTree = GetTree(_schema.Key);
                report.AddIndex(pkTree, calculateExactSizes);
            }

            foreach (var index in _schema.FixedSizeIndexes)
            {
                if (index.Value.IsGlobal)
                {
                    continue;
                }

                var fst = GetFixedSizeTree(index.Value);
                report.AddIndex(fst, calculateExactSizes);
            }

            foreach (var index in _schema.Indexes)
            {
                if (index.Value.IsGlobal)
                {
                    continue;
                }

                var tree = GetTree(index.Value);
                report.AddIndex(tree, calculateExactSizes);
            }

            var activeCandidateSection = ActiveCandidateSection;

            report.AddStructure(activeCandidateSection, calculateExactSizes);

            var inactiveSections = InactiveSections;

            report.AddStructure(inactiveSections, calculateExactSizes);

            using (var it = inactiveSections.Iterate())
            {
                if (it.Seek(0))
                {
                    do
                    {
                        var inactiveSection = new RawDataSection(_tx.LowLevelTransaction, it.CurrentKey);
                        report.AddData(inactiveSection, calculateExactSizes);
                    } while (it.MoveNext());
                }
            }

            report.AddData(ActiveDataSmallSection, calculateExactSizes);

            return(report);
        }