Beispiel #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void evict(long pageRef, org.neo4j.io.pagecache.tracing.EvictionEvent evictionEvent) throws java.io.IOException
        private void Evict(long pageRef, EvictionEvent evictionEvent)
        {
            long filePageId = GetFilePageId(pageRef);

            evictionEvent.FilePageId  = filePageId;
            evictionEvent.CachePageId = pageRef;
            int swapperId = GetSwapperId(pageRef);

            if (swapperId != 0)
            {
                // If the swapper id is non-zero, then the page was not only loaded, but also bound, and possibly modified.
                SwapperSet.SwapperMapping swapperMapping = _swappers.getAllocation(swapperId);
                if (swapperMapping != null)
                {
                    // The allocation can be null if the file has been unmapped, but there are still pages
                    // lingering in the cache that were bound to file page in that file.
                    PageSwapper swapper = swapperMapping.Swapper;
                    evictionEvent.Swapper = swapper;

                    if (IsModified(pageRef))
                    {
                        FlushModifiedPage(pageRef, evictionEvent, filePageId, swapper);
                    }
                    swapper.Evicted(filePageId);
                }
            }
            ClearBinding(pageRef);
        }
 public PinEventAnonymousInnerClass(RecordingPageCursorTracer outerInstance, long filePageId, PageSwapper swapper)
 {
     this.outerInstance = outerInstance;
     this._filePageId   = filePageId;
     this._swapper      = swapper;
     hit = true;
 }
Beispiel #3
0
 private void AllocateAndAddTenThousand(MutableIntSet allocated, PageSwapper swapper)
 {
     for (int i = 0; i < 10_000; i++)
     {
         AllocateAndAdd(allocated, swapper);
     }
 }
Beispiel #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: void fault(long pageRef, org.neo4j.io.pagecache.PageSwapper swapper, int swapperId, long filePageId, org.neo4j.io.pagecache.tracing.PageFaultEvent event) throws java.io.IOException
        internal virtual void Fault(long pageRef, PageSwapper swapper, int swapperId, long filePageId, PageFaultEvent @event)
        {
            if (swapper == null)
            {
                throw SwapperCannotBeNull();
            }
            int  currentSwapper    = GetSwapperId(pageRef);
            long currentFilePageId = GetFilePageId(pageRef);

            if (filePageId == PageCursor.UNBOUND_PAGE_ID || !IsExclusivelyLocked(pageRef) || currentSwapper != 0 || currentFilePageId != PageCursor.UNBOUND_PAGE_ID)
            {
                throw CannotFaultException(pageRef, swapper, swapperId, filePageId, currentSwapper, currentFilePageId);
            }
            // Note: It is important that we assign the filePageId before we swap
            // the page in. If the swapping fails, the page will be considered
            // loaded for the purpose of eviction, and will eventually return to
            // the freelist. However, because we don't assign the swapper until the
            // swapping-in has succeeded, the page will not be considered bound to
            // the file page, so any subsequent thread that finds the page in their
            // translation table will re-do the page fault.
            SetFilePageId(pageRef, filePageId);                 // Page now considered isLoaded()
            long bytesRead = swapper.Read(filePageId, GetAddress(pageRef), _cachePageSize);

            @event.AddBytesRead(bytesRead);
            @event.CachePageId = ToId(pageRef);
            SetSwapperId(pageRef, swapperId);                 // Page now considered isBoundTo( swapper, filePageId )
        }
Beispiel #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void mustDisableStripingIfToldTo() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void MustDisableStripingIfToldTo()
        {
            // given
            int bytesPerPage = 32;
            PageSwapperFactory    factory = CreateSwapperFactory();
            FileSystemAbstraction fs      = mock(typeof(FileSystemAbstraction));
            StoreChannel          channel = mock(typeof(StoreChannel));

            when(channel.TryLock()).thenReturn(mock(typeof(FileLock)));
            when(fs.Create(any(typeof(File)))).thenReturn(channel);
            when(fs.Open(any(typeof(File)), any())).thenReturn(channel);

            // when
            factory.Open(fs, Configuration.EMPTY);
            PageSwapper swapper = CreateSwapper(factory, _file, bytesPerPage, NoCallback, true, true);

            try
            {
                // then
                verify(fs, times(1)).open(eq(_file), any(typeof(OpenMode)));
            }
            finally
            {
                swapper.Close();
            }
        }
Beispiel #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @ParameterizedTest @ValueSource(ints = {0, 1}) @DisabledOnOs(org.junit.jupiter.api.condition.OS.WINDOWS) void fileMustRemainLockedEvenIfChannelIsClosedByStrayInterrupt(int noChannelStriping) throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void FileMustRemainLockedEvenIfChannelIsClosedByStrayInterrupt(int noChannelStriping)
        {
            PageSwapperFactory factory = CreateSwapperFactory();

            factory.Open(_fileSystem, Configuration.EMPTY);
            File file = TestDir.file("file");

            _fileSystem.create(file).close();

            PageSwapper pageSwapper = CreateSwapper(factory, file, 4, NoCallback, false, Bool(noChannelStriping));

            try
            {
                StoreChannel channel = _fileSystem.open(file, OpenMode.READ_WRITE);

                Thread.CurrentThread.Interrupt();
                pageSwapper.Force();

                assertThrows(typeof(OverlappingFileLockException), channel.tryLock);
            }
            finally
            {
                pageSwapper.Close();
            }
        }
Beispiel #7
0
        /// <summary>
        /// Allocate a new swapper id for the given <seealso cref="PageSwapper"/>.
        /// </summary>
        internal int Allocate(PageSwapper swapper)
        {
            lock (this)
            {
                SwapperMapping[] swapperMappings = this._swapperMappings;

                // First look for an available freed slot.
                lock ( _free )
                {
                    if (!_free.Empty)
                    {
                        int id = _free.intIterator().next();
                        _free.remove(id);
                        swapperMappings[id]   = new SwapperMapping(id, swapper);
                        this._swapperMappings = swapperMappings;                                  // Volatile store synchronizes-with loads in getters.
                        return(id);
                    }
                }

                // No free slot was found above, so we extend the array to make room for a new slot.
                int id = swapperMappings.Length;
                if (id + 1 > _maxSwapperId)
                {
                    throw new System.InvalidOperationException("All swapper ids are allocated: " + _maxSwapperId);
                }
                swapperMappings       = Arrays.copyOf(swapperMappings, id + 1);
                swapperMappings[id]   = new SwapperMapping(id, swapper);
                this._swapperMappings = swapperMappings;                   // Volatile store synchronizes-with loads in getters.
                return(id);
            }
        }
Beispiel #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @ParameterizedTest @ValueSource(ints = {0, 1}) void mustHandleMischiefInPositionedVectoredRead(int noChannelStriping) throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void MustHandleMischiefInPositionedVectoredRead(int noChannelStriping)
        {
            int bytesTotal   = 512;
            int bytesPerPage = 32;
            int pageCount    = bytesTotal / bytesPerPage;

            sbyte[] data = new sbyte[bytesTotal];
            ThreadLocalRandom.current().NextBytes(data);

            PageSwapperFactory factory = CreateSwapperFactory();

            factory.Open(Fs, Configuration.EMPTY);
            File        file    = File;
            PageSwapper swapper = CreateSwapper(factory, file, bytesTotal, NoCallback, true, Bool(noChannelStriping));

            try
            {
                long page = CreatePage(data);
                swapper.Write(0, page);
            }
            finally
            {
                swapper.Close();
            }

            RandomAdversary adversary = new RandomAdversary(0.5, 0.0, 0.0);

            factory.Open(new AdversarialFileSystemAbstraction(adversary, Fs), Configuration.EMPTY);
            swapper = CreateSwapper(factory, file, bytesPerPage, NoCallback, false, Bool(noChannelStriping));

            long[] pages = new long[pageCount];
            for (int i = 0; i < pageCount; i++)
            {
                pages[i] = CreatePage(bytesPerPage);
            }

            sbyte[] temp = new sbyte[bytesPerPage];
            try
            {
                for (int i = 0; i < 10_000; i++)
                {
                    foreach (long page in pages)
                    {
                        Clear(page);
                    }
                    assertThat(swapper.Read(0, pages, bytesPerPage, 0, pages.Length), @is(( long )bytesTotal));
                    for (int j = 0; j < pageCount; j++)
                    {
                        Array.Copy(data, j * bytesPerPage, temp, 0, bytesPerPage);
                        assertThat(Array(pages[j]), @is(temp));
                    }
                }
            }
            finally
            {
                swapper.Close();
            }
        }
Beispiel #9
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private long pageFault(long filePageId, org.neo4j.io.pagecache.PageSwapper swapper, long chunkOffset, int[] chunk, LatchMap.Latch latch) throws java.io.IOException
        private long PageFault(long filePageId, PageSwapper swapper, long chunkOffset, int[] chunk, LatchMap.Latch latch)
        {
            // We are page faulting. This is a critical time, because we currently have the given latch in the chunk array
            // slot that we are faulting into. We MUST make sure to release that latch, and remove it from the chunk, no
            // matter what happens. Otherwise other threads will get stuck waiting forever for our page fault to finish.
            // If we manage to get a free page to fault into, then we will also be taking a write lock on that page, to
            // protect it against concurrent eviction as we assigning a binding to the page. If anything goes wrong, then
            // we must make sure to release that write lock as well.
            PageFaultEvent faultEvent = PinEvent.beginPageFault();
            long           pageRef;

            try
            {
                // The grabFreePage method might throw.
                pageRef = PagedFile.grabFreeAndExclusivelyLockedPage(faultEvent);

                // We got a free page, and we know that we have race-free access to it. Well, it's not entirely race
                // free, because other paged files might have it in their translation tables (or rather, their reads of
                // their translation tables might race with eviction) and try to pin it.
                // However, they will all fail because when they try to pin, because the page will be exclusively locked
                // and possibly bound to our page.
            }
            catch (Exception throwable)
            {
                // Make sure to unstuck the page fault latch.
                AbortPageFault(throwable, chunk, chunkOffset, latch, faultEvent);
                throw throwable;
            }
            try
            {
                // Check if we're racing with unmapping. We have the page lock
                // here, so the unmapping would have already happened. We do this
                // check before page.fault(), because that would otherwise reopen
                // the file channel.
                AssertPagedFileStillMappedAndGetIdOfLastPage();
                PagedFile.initBuffer(pageRef);
                PagedFile.fault(pageRef, swapper, PagedFile.swapperId, filePageId, faultEvent);
            }
            catch (Exception throwable)
            {
                // Make sure to unlock the page, so the eviction thread can pick up our trash.
                PagedFile.unlockExclusive(pageRef);
                // Make sure to unstuck the page fault latch.
                AbortPageFault(throwable, chunk, chunkOffset, latch, faultEvent);
                throw throwable;
            }
            // Put the page in the translation table before we undo the exclusive lock, as we could otherwise race with
            // eviction, and the onEvict callback expects to find a MuninnPage object in the table.
            UnsafeUtil.putIntVolatile(chunk, chunkOffset, PagedFile.toId(pageRef));
            // Once we page has been published to the translation table, we can convert our exclusive lock to whatever we
            // need for the page cursor.
            ConvertPageFaultLock(pageRef);
            latch.Release();
            faultEvent.Done();
            return(pageRef);
        }
Beispiel #10
0
        private void AllocateFreeAndAssertNotReused(PageSwapper swapper, MutableIntSet ids, int i)
        {
            int id = _set.allocate(swapper);

            _set.free(id);
            if (!ids.add(id))
            {
                fail("Expected ids.add( id ) to return true for id " + id + " in iteration " + i + " but it instead returned false");
            }
        }
Beispiel #11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @ParameterizedTest @ValueSource(ints = {0, 1}) void mustHandleMischiefInPositionedVectoredWrite(int noChannelStriping) throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void MustHandleMischiefInPositionedVectoredWrite(int noChannelStriping)
        {
            int bytesTotal   = 512;
            int bytesPerPage = 32;
            int pageCount    = bytesTotal / bytesPerPage;

            sbyte[] data = new sbyte[bytesTotal];
            ThreadLocalRandom.current().NextBytes(data);
            long zeroPage = CreatePage(bytesPerPage);

            Clear(zeroPage);

            File file = File;
            PageSwapperFactory factory   = CreateSwapperFactory();
            RandomAdversary    adversary = new RandomAdversary(0.5, 0.0, 0.0);

            factory.Open(new AdversarialFileSystemAbstraction(adversary, Fs), Configuration.EMPTY);
            PageSwapper swapper = CreateSwapper(factory, file, bytesPerPage, NoCallback, true, Bool(noChannelStriping));

            long[] writePages = new long[pageCount];
            long[] readPages  = new long[pageCount];
            long[] zeroPages  = new long[pageCount];
            for (int i = 0; i < pageCount; i++)
            {
                writePages[i] = CreatePage(bytesPerPage);
                PutBytes(writePages[i], data, 0, i * bytesPerPage, bytesPerPage);
                readPages[i] = CreatePage(bytesPerPage);
                zeroPages[i] = zeroPage;
            }

            try
            {
                for (int i = 0; i < 10_000; i++)
                {
                    adversary.ProbabilityFactor = 0;
                    swapper.Write(0, zeroPages, 0, pageCount);
                    adversary.ProbabilityFactor = 1;
                    swapper.Write(0, writePages, 0, pageCount);
                    foreach (long readPage in readPages)
                    {
                        Clear(readPage);
                    }
                    adversary.ProbabilityFactor = 0;
                    assertThat(swapper.Read(0, readPages, bytesPerPage, 0, pageCount), @is(( long )bytesTotal));
                    for (int j = 0; j < pageCount; j++)
                    {
                        assertThat(Array(readPages[j]), @is(Array(writePages[j])));
                    }
                }
            }
            finally
            {
                swapper.Close();
            }
        }
Beispiel #12
0
 internal void Initialise(MuninnPagedFile pagedFile, long pageId, int pfFlags)
 {
     this.Swapper       = pagedFile.Swapper;
     this.SwapperId     = pagedFile.SwapperId;
     this._filePageSize = pagedFile.FilePageSize;
     this.PagedFile     = pagedFile;
     this.PageId        = pageId;
     this.PfFlags       = pfFlags;
     this.EagerFlush    = IsFlagRaised(pfFlags, PF_EAGER_FLUSH);
     this.NoFault       = IsFlagRaised(pfFlags, PF_NO_FAULT);
     this.NoGrow        = NoFault | IsFlagRaised(pfFlags, Org.Neo4j.Io.pagecache.PagedFile_Fields.PfNoGrow);
 }
Beispiel #13
0
 public void Vote(bool value)
 {
     PageSwapper.SetPage(PageSwapper.Page + 1, true);
     PlayerPrefs.SetInt("currentDatingPage", PageSwapper.Page);
     if (value && Random.Range(0f, 1f) > .5f)
     {
         Profile p = Data.SearchProfile(photo.sprite);
         if (p != null && !Data.chats.Contains(p))
         {
             Data.chats.Add(p);
         }
     }
 }
Beispiel #14
0
 public override MajorFlushEvent BeginFileFlush(PageSwapper swapper)
 {
     Latch.Signal();
     try
     {
         Latch.await();
     }
     catch (InterruptedException e)
     {
         Console.WriteLine(e.ToString());
         Console.Write(e.StackTrace);
     }
     return(MajorFlushEvent.NULL);
 }
Beispiel #15
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @ParameterizedTest @ValueSource(ints = {0, 1}) void mustZeroFillPageBeyondEndOfFile(int noChannelStriping) throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void MustZeroFillPageBeyondEndOfFile(int noChannelStriping)
        {
            sbyte[]      bytes   = new sbyte[] { 1, 2, 3, 4, 5, 6 };
            StoreChannel channel = Fs.create(File);

            channel.WriteAll(Wrap(bytes));
            channel.close();

            PageSwapperFactory factory = CreateSwapperFactory();
            PageSwapper        swapper = CreateSwapper(factory, File, 4, null, false, Bool(noChannelStriping));
            long target = CreatePage(4);

            swapper.Read(1, target, SizeOfAsInt(target));

            assertThat(Array(target), byteArray(new sbyte[] { 5, 6, 0, 0 }));
        }
Beispiel #16
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @ParameterizedTest @ValueSource(ints = {0, 1}) void swappingInMustFillPageWithData(int noChannelStriping) throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void SwappingInMustFillPageWithData(int noChannelStriping)
        {
            sbyte[]      bytes   = new sbyte[] { 1, 2, 3, 4 };
            StoreChannel channel = Fs.create(File);

            channel.WriteAll(Wrap(bytes));
            channel.close();

            PageSwapperFactory factory = CreateSwapperFactory();
            PageSwapper        swapper = CreateSwapper(factory, File, 4, null, false, Bool(noChannelStriping));
            long target = CreatePage(4);

            swapper.Read(0, target, SizeOfAsInt(target));

            assertThat(Array(target), byteArray(bytes));
        }
Beispiel #17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @ParameterizedTest @ValueSource(ints = {0, 1}) void mustHandleMischiefInPositionedRead(int noChannelStriping) throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void MustHandleMischiefInPositionedRead(int noChannelStriping)
        {
            int bytesTotal = 512;

            sbyte[] data = new sbyte[bytesTotal];
            ThreadLocalRandom.current().NextBytes(data);

            PageSwapperFactory factory = CreateSwapperFactory();

            factory.Open(Fs, Configuration.EMPTY);
            File        file    = File;
            PageSwapper swapper = CreateSwapper(factory, file, bytesTotal, NoCallback, true, Bool(noChannelStriping));

            try
            {
                long page = CreatePage(data);
                swapper.Write(0, page);
            }
            finally
            {
                swapper.Close();
            }

            RandomAdversary adversary = new RandomAdversary(0.5, 0.0, 0.0);

            factory.Open(new AdversarialFileSystemAbstraction(adversary, Fs), Configuration.EMPTY);
            swapper = CreateSwapper(factory, file, bytesTotal, NoCallback, false, Bool(noChannelStriping));

            long page = CreatePage(bytesTotal);

            try
            {
                for (int i = 0; i < 10_000; i++)
                {
                    Clear(page);
                    assertThat(swapper.Read(0, page, SizeOfAsInt(page)), @is(( long )bytesTotal));
                    assertThat(Array(page), @is(data));
                }
            }
            finally
            {
                swapper.Close();
            }
        }
Beispiel #18
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @ParameterizedTest @ValueSource(ints = {0, 1}) void swappingOutMustWritePageToFile(int noChannelStriping) throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void SwappingOutMustWritePageToFile(int noChannelStriping)
        {
            Fs.create(File).close();

            sbyte[] expected = new sbyte[] { 1, 2, 3, 4 };
            long    page     = CreatePage(expected);

            PageSwapperFactory factory = CreateSwapperFactory();
            PageSwapper        swapper = CreateSwapper(factory, File, 4, null, false, Bool(noChannelStriping));

            swapper.Write(0, page);

            Stream stream = Fs.openAsInputStream(File);

            sbyte[] actual = new sbyte[expected.Length];

            assertThat(stream.Read(actual, 0, actual.Length), @is(actual.Length));
            assertThat(actual, byteArray(expected));
        }
Beispiel #19
0
    public static void OpenChat(Profile profile)
    {
        if (SceneManager.GetActiveScene().name != "Chat")
        {
            SceneManager.LoadScene("Chat");
        }

        Text  name  = GameObject.Find("Canvas/Grid/Page1/TopBar/Name").GetComponent <Text>();
        Image image = GameObject.Find("Canvas/Grid/Page1/TopBar/PhotoMask/Photo").GetComponent <Image>();

        name.text    = profile.name;
        image.sprite = profile.profilePic;

        MessageHandler messageHandler = GameObject.Find("Canvas/Grid/Page1/InputBar/InputField").GetComponent <MessageHandler>();

        Debug.Log("message");
        messageHandler.SetMessages(profile);

        PageSwapper.SetPage(1);
    }
Beispiel #20
0
        /// <summary>
        /// The OverlappingFileLockException is thrown when tryLock is called on the same file *in the same JVM*.
        /// </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @ParameterizedTest @ValueSource(ints = {0, 1}) @DisabledOnOs(org.junit.jupiter.api.condition.OS.WINDOWS) void creatingSwapperForFileMustTakeLockOnFile(int noChannelStriping) throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void CreatingSwapperForFileMustTakeLockOnFile(int noChannelStriping)
        {
            PageSwapperFactory factory = CreateSwapperFactory();

            factory.Open(_fileSystem, Configuration.EMPTY);
            File file = TestDir.file("file");

            _fileSystem.create(file).close();

            PageSwapper pageSwapper = CreateSwapper(factory, file, 4, NoCallback, false, Bool(noChannelStriping));

            try
            {
                StoreChannel channel = _fileSystem.open(file, OpenMode.READ_WRITE);
                assertThrows(typeof(OverlappingFileLockException), channel.tryLock);
            }
            finally
            {
                pageSwapper.Close();
            }
        }
Beispiel #21
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @ParameterizedTest @ValueSource(ints = {0, 1}) void swappingOutMustNotOverwriteDataBeyondPage(int noChannelStriping) throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void SwappingOutMustNotOverwriteDataBeyondPage(int noChannelStriping)
        {
            sbyte[]      initialData = new sbyte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            sbyte[]      finalData   = new sbyte[] { 1, 2, 3, 4, 8, 7, 6, 5, 9, 10 };
            StoreChannel channel     = Fs.create(File);

            channel.WriteAll(Wrap(initialData));
            channel.close();

            sbyte[] change = new sbyte[] { 8, 7, 6, 5 };
            long    page   = CreatePage(change);

            PageSwapperFactory factory = CreateSwapperFactory();
            PageSwapper        swapper = CreateSwapper(factory, File, 4, null, false, Bool(noChannelStriping));

            swapper.Write(1, page);

            Stream stream = Fs.openAsInputStream(File);

            sbyte[] actual = new sbyte[( int )Fs.getFileSize(File)];

            assertThat(stream.Read(actual, 0, actual.Length), @is(actual.Length));
            assertThat(actual, byteArray(finalData));
        }
Beispiel #22
0
 void Start()
 {
     PageSwapper.SetPage(PlayerPrefs.GetInt("currentDatingPage"));
 }
Beispiel #23
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @BeforeEach public void setUp()
        public virtual void SetUp()
        {
            _tracer  = new DefaultPageCacheTracer();
            _swapper = new DummyPageSwapper("filename", ( int )ByteUnit.kibiBytes(8));
        }
 public override MajorFlushEvent BeginFileFlush(PageSwapper swapper)
 {
     return(@delegate.BeginFileFlush(swapper));
 }
Beispiel #25
0
 public override FlushEvent BeginFlush(long filePageId, long cachePageId, PageSwapper swapper)
 {
     return(Tracer.add(new FlushHEvent(Tracer, filePageId, cachePageId, swapper)));
 }
Beispiel #26
0
 internal PinHEvent(LinearHistoryTracer tracer, bool exclusiveLock, long filePageId, PageSwapper swapper) : base(tracer)
 {
     this.ExclusiveLock = exclusiveLock;
     this.FilePageId    = filePageId;
     this.HitConflict   = true;
     this.File          = swapper.File();
 }
Beispiel #27
0
 internal FlushHEvent(LinearHistoryTracer tracer, long filePageId, long cachePageId, PageSwapper swapper) : base(tracer)
 {
     this.FilePageId  = filePageId;
     this.CachePageId = cachePageId;
     this.PageCount   = 1;
     this.File        = swapper.File();
 }
 public override MajorFlushEvent BeginFileFlush(PageSwapper swapper)
 {
     return(_tracer.add(new MajorFlushHEvent(_tracer, swapper.File())));
 }
Beispiel #29
0
 internal SwapperMapping(int id, PageSwapper swapper)
 {
     this.Id      = id;
     this.Swapper = swapper;
 }
Beispiel #30
0
 public override MajorFlushEvent BeginFileFlush(PageSwapper swapper)
 {
     return(MajorFlushEvent.NULL);
 }