コード例 #1
0
        private static long ReadSlot(PageCursor cursor)
        {
            long  generation = GenerationSafePointer.ReadGeneration(cursor);
            long  pointer    = GenerationSafePointer.ReadPointer(cursor);
            short checksum   = GenerationSafePointer.ReadChecksum(cursor);

            assertEquals(GenerationSafePointer.ChecksumOf(generation, pointer), checksum);
            return(pointer);
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void checkSiblingShouldThrowOnReadIllegalPointer()
        internal virtual void CheckSiblingShouldThrowOnReadIllegalPointer()
        {
            // GIVEN
            long generation = IdSpace.STATE_PAGE_A;
            long pointer    = this._secondGeneration;

            // Can not use GenerationSafePointer.write because it will fail on pointer assertion.
            _cursor.putInt(( int )pointer);
            put6BLong(_cursor, generation);
            _cursor.putShort(GenerationSafePointer.ChecksumOf(generation, pointer));
            _cursor.rewind();

            // WHEN
            long result = read(_cursor, _firstGeneration, pointer, NO_GENERATION_TARGET);

            assertThrows(typeof(TreeInconsistencyException), () => PointerChecking.checkPointer(result, true));
        }
コード例 #3
0
 private static short ChecksumOf(GSP gsp)
 {
     return(GenerationSafePointer.ChecksumOf(gsp.Generation, gsp.Pointer));
 }