public StorageReport GenerateReport(Transaction tx, bool computeExactSizes = false) { var numberOfAllocatedPages = Math.Max(_dataPager.NumberOfAllocatedPages, NextPageNumber - 1); // async apply to data file task var numberOfFreePages = _freeSpaceHandling.AllPages(tx).Count; var trees = new List <Tree>(); using (var rootIterator = tx.Root.Iterate()) { if (rootIterator.Seek(Slice.BeforeAllKeys)) { do { var tree = tx.ReadTree(rootIterator.CurrentKey.ToString()); trees.Add(tree); }while (rootIterator.MoveNext()); } } var generator = new StorageReportGenerator(tx); return(generator.Generate(new ReportInput { NumberOfAllocatedPages = numberOfAllocatedPages, NumberOfFreePages = numberOfFreePages, NextPageNumber = NextPageNumber, Journals = Journal.Files.ToList(), Trees = trees, IsLightReport = !computeExactSizes })); }
public StorageReport GenerateReport(Transaction tx) { var numberOfAllocatedPages = Math.Max(_dataPager.NumberOfAllocatedPages, NextPageNumber - 1); // async apply to data file task var numberOfFreePages = _freeSpaceHandling.AllPages(tx.LowLevelTransaction).Count; var countOfTrees = 0; var countOfTables = 0; using (var rootIterator = tx.LowLevelTransaction.RootObjects.Iterate(false)) { if (rootIterator.Seek(Slices.BeforeAllKeys)) { do { var currentKey = rootIterator.CurrentKey.Clone(tx.Allocator); var type = tx.GetRootObjectType(currentKey); switch (type) { case RootObjectType.VariableSizeTree: countOfTrees++; break; case RootObjectType.EmbeddedFixedSizeTree: break; case RootObjectType.FixedSizeTree: countOfTrees++; break; case RootObjectType.Table: countOfTables++; break; default: throw new ArgumentOutOfRangeException(); } }while (rootIterator.MoveNext()); } } var generator = new StorageReportGenerator(tx.LowLevelTransaction); return(generator.Generate(new ReportInput { NumberOfAllocatedPages = numberOfAllocatedPages, NumberOfFreePages = numberOfFreePages, NextPageNumber = NextPageNumber, CountOfTrees = countOfTrees, CountOfTables = countOfTables, Journals = Journal.Files.ToList() })); }
public StorageReport GenerateReport(Transaction tx, bool computeExactSizes = false) { var numberOfAllocatedPages = Math.Max(_dataPager.NumberOfAllocatedPages, NextPageNumber - 1); // async apply to data file task var numberOfFreePages = _freeSpaceHandling.AllPages(tx.LowLevelTransaction).Count; var trees = new List <Tree>(); var fixedSizeTrees = new List <FixedSizeTree>(); using (var rootIterator = tx.LowLevelTransaction.RootObjects.Iterate(false)) { if (rootIterator.Seek(Slices.BeforeAllKeys)) { do { var curretKey = rootIterator.CurrentKey.Clone(tx.Allocator); switch (tx.GetRootObjectType(curretKey)) { case RootObjectType.VariableSizeTree: var tree = tx.ReadTree(curretKey.ToString()); trees.Add(tree); break; case RootObjectType.EmbeddedFixedSizeTree: break; case RootObjectType.FixedSizeTree: fixedSizeTrees.Add(tx.FixedTreeFor(curretKey, 0)); break; default: throw new ArgumentOutOfRangeException(); } }while (rootIterator.MoveNext()); } } var generator = new StorageReportGenerator(tx.LowLevelTransaction); return(generator.Generate(new ReportInput { NumberOfAllocatedPages = numberOfAllocatedPages, NumberOfFreePages = numberOfFreePages, NextPageNumber = NextPageNumber, Journals = Journal.Files.ToList(), Trees = trees, FixedSizeTrees = fixedSizeTrees, IsLightReport = !computeExactSizes })); }
public unsafe DetailedStorageReport GenerateDetailedReport(Transaction tx, bool calculateExactSizes = false) { var numberOfAllocatedPages = Math.Max(_dataPager.NumberOfAllocatedPages, NextPageNumber - 1); // async apply to data file task var numberOfFreePages = _freeSpaceHandling.AllPages(tx.LowLevelTransaction).Count; var trees = new List <Tree>(); var fixedSizeTrees = new List <FixedSizeTree>(); var tables = new List <Table>(); using (var rootIterator = tx.LowLevelTransaction.RootObjects.Iterate(false)) { if (rootIterator.Seek(Slices.BeforeAllKeys)) { do { var currentKey = rootIterator.CurrentKey.Clone(tx.Allocator); var type = tx.GetRootObjectType(currentKey); switch (type) { case RootObjectType.VariableSizeTree: var tree = tx.ReadTree(currentKey); trees.Add(tree); break; case RootObjectType.EmbeddedFixedSizeTree: break; case RootObjectType.FixedSizeTree: if (SliceComparer.AreEqual(currentKey, NewPageAllocator.AllocationStorage)) // will be counted inside pre allocated buffers report { continue; } fixedSizeTrees.Add(tx.FixedTreeFor(currentKey)); break; case RootObjectType.Table: var tableTree = tx.ReadTree(currentKey, RootObjectType.Table); var writtenSchemaData = tableTree.DirectRead(TableSchema.SchemasSlice); var writtenSchemaDataSize = tableTree.GetDataSize(TableSchema.SchemasSlice); var tableSchema = TableSchema.ReadFrom(tx.Allocator, writtenSchemaData, writtenSchemaDataSize); var table = tx.OpenTable(tableSchema, currentKey); tables.Add(table); break; default: throw new ArgumentOutOfRangeException(); } }while (rootIterator.MoveNext()); } } var generator = new StorageReportGenerator(tx.LowLevelTransaction); return(generator.Generate(new DetailedReportInput { NumberOfAllocatedPages = numberOfAllocatedPages, NumberOfFreePages = numberOfFreePages, NextPageNumber = NextPageNumber, Journals = Journal.Files.ToList(), Trees = trees, FixedSizeTrees = fixedSizeTrees, Tables = tables, CalculateExactSizes = calculateExactSizes, ScratchBufferPoolInfo = _scratchBufferPool.InfoForDebug(PossibleOldestReadTransaction(tx.LowLevelTransaction)) })); }