示例#1
0
 internal FreeListIdProvider(PagedFile pagedFile, int pageSize, long lastId, Monitor monitor)
 {
     this._pagedFile    = pagedFile;
     this._monitor      = monitor;
     this._freelistNode = new FreelistNode(pageSize);
     this._lastId       = lastId;
 }
示例#2
0
 public UpdateWorkerAnonymousInnerClass(PageCacheSlowTest <T> outerInstance, int i, int filePages, AtomicBoolean shouldStop, Org.Neo4j.Io.pagecache.PagedFile pagedFile) : base(i, filePages, shouldStop, pagedFile)
 {
     this.outerInstance = outerInstance;
     this._shouldStop   = shouldStop;
     this._filePages    = filePages;
     this._pagedFile    = pagedFile;
 }
示例#3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: PageLoader getLoader(org.neo4j.io.pagecache.PagedFile file) throws java.io.IOException
        internal virtual PageLoader GetLoader(PagedFile file)
        {
            if (FileUtils.highIODevice(file.File().toPath(), false))
            {
                return(new ParallelPageLoader(file, _executor, _pageCache));
            }
            return(new SingleCursorPageLoader(file));
        }
示例#4
0
 internal KeyValueStoreFile(PagedFile file, int keySize, int valueSize, Metadata metadata)
 {
     this._file          = file;
     this._keySize       = keySize;
     this._valueSize     = valueSize;
     this._headerEntries = metadata.HeaderEntries();
     this._totalEntries  = metadata.TotalEntries();
     this._headers       = metadata.Headers();
     this._pageCatalogue = metadata.PageCatalogue();
 }
示例#5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void verifyPageCacheLongArray() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void VerifyPageCacheLongArray()
        {
            PageCache pageCache = _pageCacheRule.getPageCache(_fs);
            PagedFile file      = pageCache.Map(_dir.file("file"), pageCache.PageSize(), CREATE, DELETE_ON_CLOSE);

            using (LongArray array = new PageCacheLongArray(file, COUNT, 0, 0))
            {
                VerifyBehaviour(array);
            }
        }
示例#6
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);
                }
            }
        }
 public override ByteArray NewByteArray(long length, sbyte[] defaultValue, long @base)
 {
     try
     {
         File      tempFile  = File.createTempFile("byteArray", ".tmp", _storeDir);
         PagedFile pagedFile = _pageCache.map(tempFile, _pageCache.pageSize(), DELETE_ON_CLOSE, CREATE);
         return(new PageCacheByteArray(pagedFile, length, defaultValue, @base));
     }
     catch (IOException e)
     {
         throw new UncheckedIOException(e);
     }
 }
示例#8
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);
            }
        }
示例#9
0
        public override void Set(long index, long value)
        {
            long pageId = pageId(index);
            int  offset = offset(index);

            try
            {
                using (PageCursor cursor = PagedFile.io(pageId, PF_SHARED_WRITE_LOCK | PF_NO_GROW))
                {
                    cursor.Next();
                    cursor.PutLong(offset, value);
                    CheckBounds(cursor);
                }
            }
            catch (IOException e)
            {
                throw new UncheckedIOException(e);
            }
        }
示例#10
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;
            }
        }
示例#11
0
        private bool DatabaseExistsAndContainsData()
        {
            File metaDataFile = _databaseLayout.metadataStore();

            try
            {
                using (PagedFile pagedFile = _pageCache.map(metaDataFile, _pageCache.pageSize(), StandardOpenOption.READ))
                {
                    // OK so the db probably exists
                }
            }
            catch (IOException)
            {
                // It's OK
                return(false);
            }

            using (NeoStores stores = NewStoreFactory(_databaseLayout).openNeoStores(StoreType.NODE, StoreType.RELATIONSHIP))
            {
                return(stores.NodeStore.HighId > 0 || stores.RelationshipStore.HighId > 0);
            }
        }
示例#12
0
        public override long Get(long index)
        {
            long pageId = pageId(index);
            int  offset = offset(index);

            try
            {
                using (PageCursor cursor = PagedFile.io(pageId, PF_SHARED_READ_LOCK))
                {
                    cursor.Next();
                    long result;
                    do
                    {
                        result = cursor.GetLong(offset);
                    } while (cursor.ShouldRetry());
                    CheckBounds(cursor);
                    return(result);
                }
            }
            catch (IOException e)
            {
                throw new UncheckedIOException(e);
            }
        }
示例#13
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);
        }
示例#14
0
 public AdversarialPagedFile(PagedFile @delegate, Adversary adversary)
 {
     this.@delegate  = Objects.requireNonNull(@delegate);
     this._adversary = Objects.requireNonNull(adversary);
 }
示例#15
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: PageCacheLongArray(org.neo4j.io.pagecache.PagedFile pagedFile, long length, long defaultValue, long super) throws java.io.IOException
        internal PageCacheLongArray(PagedFile pagedFile, long length, long defaultValue, long @base) : base(pagedFile, Long.BYTES, length, defaultValue, @base)
        {
        }
示例#16
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 super) throws java.io.IOException
        internal PageCacheNumberArray(PagedFile pagedFile, int entrySize, long length, long @base) : this(pagedFile, entrySize, length, 0, @base)
        {
        }
示例#17
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: PageCacheIntArray(org.neo4j.io.pagecache.PagedFile pagedFile, long length, long defaultValue, long super) throws java.io.IOException
        internal PageCacheIntArray(PagedFile pagedFile, long length, long defaultValue, long @base) : base(pagedFile, Integer.BYTES, length, defaultValue | defaultValue << (sizeof(int) * 8), @base)
        {
        }