Example #1
0
        private IEnumerable <BsonDocument> GetList(uint pageID, string indexName, TransactionService transaction, Snapshot snapshot)
        {
            if (pageID == uint.MaxValue)
            {
                yield break;
            }

            var page = snapshot.GetPage <BasePage>(pageID);

            while (page != null)
            {
                _collections.TryGetValue(page.ColID, out var collection);

                yield return(new BsonDocument
                {
                    ["pageID"] = (int)page.PageID,
                    ["pageType"] = page.PageType.ToString(),
                    ["slot"] = (int)page.PageListSlot,
                    ["collection"] = collection,
                    ["index"] = indexName,
                    ["freeBytes"] = page.FreeBytes,
                    ["itemsCount"] = (int)page.ItemsCount
                });

                if (page.NextPageID == uint.MaxValue)
                {
                    break;
                }

                transaction.Safepoint();

                page = snapshot.GetPage <BasePage>(page.NextPageID);
            }
        }
Example #2
0
        // load documents from document loader
        protected async IAsyncEnumerable <BsonDocument> LoadDocument(IAsyncEnumerable <IndexNode> nodes)
        {
            await foreach (var node in nodes)
            {
                yield return(await _lookup.Load(node));

                // check if transaction all full of pages to clear before continue
                await _transaction.Safepoint();
            }
        }