Exemplo n.º 1
0
        /// <summary>
        /// Visit the header, that is tree state and meta information, about the tree present in the given {@code file}.
        /// </summary>
        /// <param name="pageCache"> <seealso cref="PageCache"/> able to map tree contained in {@code file}. </param>
        /// <param name="file"> <seealso cref="File"/> containing the tree to print header for. </param>
        /// <param name="visitor"> <seealso cref="GBPTreeVisitor"/> that shall visit header. </param>
        /// <exception cref="IOException"> on I/O error. </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static void visitHeader(org.neo4j.io.pagecache.PageCache pageCache, java.io.File file, GBPTreeVisitor visitor) throws java.io.IOException
        public static void VisitHeader(PageCache pageCache, File file, GBPTreeVisitor visitor)
        {
            using (PagedFile pagedFile = pageCache.Map(file, pageCache.PageSize(), StandardOpenOption.READ))
            {
                using (PageCursor cursor = pagedFile.Io(IdSpace.STATE_PAGE_A, Org.Neo4j.Io.pagecache.PagedFile_Fields.PF_SHARED_READ_LOCK))
                {
                    VisitMeta(cursor, visitor);
                    VisitTreeState(cursor, visitor);
                }
            }
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.neo4j.io.pagecache.PageCursor io(long pageId, int pf_flags) throws java.io.IOException
        public override PageCursor Io(long pageId, int pfFlags)
        {
            _adversary.injectFailure(typeof(System.InvalidOperationException));
            PageCursor pageCursor = @delegate.Io(pageId, pfFlags);

            if ((pfFlags & Org.Neo4j.Io.pagecache.PagedFile_Fields.PF_SHARED_READ_LOCK) == Org.Neo4j.Io.pagecache.PagedFile_Fields.PF_SHARED_READ_LOCK)
            {
                return(new AdversarialReadPageCursor(pageCursor, _adversary));
            }
            return(new AdversarialWritePageCursor(pageCursor, _adversary));
        }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: There is no .NET equivalent to the Java 'super' constraint:
//ORIGINAL LINE: static <Buffer extends BigEndianByteArrayBuffer> void scanAll(org.neo4j.io.pagecache.PagedFile file, int startOffset, EntryVisitor<? super Buffer> visitor, Buffer key, Buffer value) throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal static void ScanAll <Buffer, T1>(PagedFile file, int startOffset, EntryVisitor <T1> visitor, Buffer key, Buffer value) where Buffer : BigEndianByteArrayBuffer
        {
            bool visitHeaders = !(visitor is KeyValueVisitor);

            using (PageCursor cursor = file.Io(startOffset / file.PageSize(), PF_SHARED_READ_LOCK))
            {
                if (!cursor.Next())
                {
                    return;
                }
                ReadKeyValuePair(cursor, startOffset, key, value);
                VisitKeyValuePairs(file.PageSize(), cursor, startOffset, visitor, visitHeaders, key, value);
            }
        }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: PageCacheNumberArray(org.neo4j.io.pagecache.PagedFile pagedFile, int entrySize, long length, long defaultValue, long super) throws java.io.IOException
        internal PageCacheNumberArray(PagedFile pagedFile, int entrySize, long length, long defaultValue, long @base)
        {
            this.PagedFile      = pagedFile;
            this.EntrySize      = entrySize;
            this.EntriesPerPage = pagedFile.PageSize() / entrySize;
            this._length        = length;
            this._defaultValue  = defaultValue;
            this.@base          = @base;

            using (PageCursor cursorToSetLength = pagedFile.Io(0, PF_SHARED_WRITE_LOCK))
            {
                SetLength(cursorToSetLength, length);
            }

            if (defaultValue != 0)
            {
                DefaultValue = defaultValue;
            }
        }
Exemplo n.º 5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: SingleCursorPageLoader(org.neo4j.io.pagecache.PagedFile file) throws java.io.IOException
        internal SingleCursorPageLoader(PagedFile file)
        {
            _cursor = file.Io(0, PF_SHARED_READ_LOCK);
        }