Exemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void releaseId(long stableGeneration, long unstableGeneration, long id) throws java.io.IOException
        public override void ReleaseId(long stableGeneration, long unstableGeneration, long id)
        {
            using (PageCursor cursor = _pagedFile.io(_writePageId, Org.Neo4j.Io.pagecache.PagedFile_Fields.PfSharedWriteLock))
            {
                PageCursorUtil.GoTo(cursor, "free-list write page", _writePageId);
                _freelistNode.write(cursor, unstableGeneration, id, _writePos);
                _writePos++;
            }

            if (_writePos >= _freelistNode.maxEntries())
            {
                // Current free-list write page is full, allocate a new one.
                long nextFreelistPage = AcquireNewId(stableGeneration, unstableGeneration, false);
                using (PageCursor cursor = _pagedFile.io(_writePageId, Org.Neo4j.Io.pagecache.PagedFile_Fields.PfSharedWriteLock))
                {
                    PageCursorUtil.GoTo(cursor, "free-list write page", _writePageId);
                    FreelistNode.Initialize(cursor);
                    // Link previous --> new writer page
                    FreelistNode.SetNext(cursor, nextFreelistPage);
                }
                _writePageId = nextFreelistPage;
                _writePos    = 0;
                _monitor.acquiredFreelistPageId(nextFreelistPage);
            }
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldSetAndGetNext()
        internal virtual void ShouldSetAndGetNext()
        {
            // GIVEN
            long nextId = 12345;

            // WHEN
            FreelistNode.SetNext(_cursor, nextId);
            long readNextId = FreelistNode.Next(_cursor);

            // THEN
            assertEquals(nextId, readNextId);
        }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldNodeOverwriteNodeType()
        internal virtual void ShouldNodeOverwriteNodeType()
        {
            // GIVEN
            FreelistNode.Initialize(_cursor);
            sbyte nodeType = TreeNode.NodeType(_cursor);

            assertEquals(TreeNode.NODE_TYPE_FREE_LIST_NODE, nodeType);

            // WHEN
            long someId = 1234;

            FreelistNode.SetNext(_cursor, someId);

            // THEN
            nodeType = TreeNode.NodeType(_cursor);
            assertEquals(TreeNode.NODE_TYPE_FREE_LIST_NODE, nodeType);
        }