Example #1
0
        public override void VisitFreelist(IdProvider_IdProviderVisitor visitor)
        {
            int pos = 0;

            visitor.BeginFreelistPage(0);
            foreach (Pair <long, long> releasedId in _releasedIds)
            {
                visitor.FreelistEntry(releasedId.Right, releasedId.Left, pos++);
            }
            visitor.EndFreelistPage(0);
        }
Example #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void visitFreelist(IdProvider_IdProviderVisitor visitor) throws java.io.IOException
        public override void VisitFreelist(IdProvider_IdProviderVisitor visitor)
        {
            if (_readPageId == FreelistNode.NoPageId)
            {
                return;
            }

            using (PageCursor cursor = _pagedFile.io(0, Org.Neo4j.Io.pagecache.PagedFile_Fields.PF_SHARED_READ_LOCK))
            {
                GenerationKeeper generation = new GenerationKeeper();
                long             prevPage;
                long             pageId = _readPageId;
                int pos = _readPos;
                do
                {
                    PageCursorUtil.GoTo(cursor, "free-list", pageId);
                    visitor.BeginFreelistPage(pageId);
                    int targetPos = pageId == _writePageId ? _writePos : _freelistNode.maxEntries();
                    while (pos < targetPos)
                    {
                        // Read next un-acquired id
                        long unacquiredId;
                        do
                        {
                            unacquiredId = _freelistNode.read(cursor, long.MaxValue, pos, generation);
                        } while (cursor.ShouldRetry());
                        visitor.FreelistEntry(unacquiredId, generation.Generation, pos);
                        pos++;
                    }
                    visitor.EndFreelistPage(pageId);

                    prevPage = pageId;
                    pos      = 0;
                    do
                    {
                        pageId = FreelistNode.Next(cursor);
                    } while (cursor.ShouldRetry());
                } while (prevPage != _writePageId);
            }
        }