Exemplo n.º 1
0
 /// <summary>
 /// Calls <seealso cref="PageCursor.checkAndClearBoundsFlag()"/> and if {@code true} throws <seealso cref="TreeInconsistencyException"/>.
 /// Should be called whenever leaving a <seealso cref="PageCursor.shouldRetry() shouldRetry-loop"/> successfully.
 /// Purpose of this method is to unify <seealso cref="PageCursor"/> read behavior and exception handling.
 /// </summary>
 /// <param name="cursor"> <seealso cref="PageCursor"/> to check for out-of-bounds. </param>
 internal static void CheckOutOfBounds(PageCursor cursor)
 {
     if (cursor.CheckAndClearBoundsFlag())
     {
         throw new TreeInconsistencyException("Some internal problem causing out of bounds: pageId:" + cursor.CurrentPageId);
     }
 }
Exemplo n.º 2
0
 protected internal virtual void CheckBounds(PageCursor cursor)
 {
     if (cursor.CheckAndClearBoundsFlag())
     {
         throw new System.InvalidOperationException(string.Format("Cursor {0} access out of bounds, page id {1:D}, offset {2:D}", cursor.ToString(), cursor.CurrentPageId, cursor.Offset));
     }
 }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: static void readKeyValuePair(org.neo4j.io.pagecache.PageCursor cursor, int offset, WritableBuffer key, WritableBuffer value) throws java.io.IOException
        internal static void ReadKeyValuePair(PageCursor cursor, int offset, WritableBuffer key, WritableBuffer value)
        {
            long retriesLeft = MAX_LOOKUP_RETRY_COUNT;

            do
            {
                cursor.Offset = offset;
                key.GetFrom(cursor);
                value.GetFrom(cursor);
            } while (cursor.ShouldRetry() && (--retriesLeft) > 0);

            if (cursor.CheckAndClearBoundsFlag())
            {
                ThrowOutOfBounds(cursor, offset);
            }

            if (retriesLeft == 0)
            {
                ThrowFailedRead(cursor, offset);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Checks the given <seealso cref="PageCursor"/> to see if its out-of-bounds flag has been raised, and returns {@code true} if
 /// that is the case <em>and</em> and out-of-bounds condition should be reported up the stack. </summary>
 /// <param name="cursor"> The <seealso cref="PageCursor"/> to check the bounds flag for. </param>
 /// <returns> {@code true} if an out-of-bounds condition should be reported up the stack, {@code false} otherwise. </returns>
 public bool CheckForOutOfBounds(Org.Neo4j.Io.pagecache.PageCursor cursor)
 {
     return(cursor.CheckAndClearBoundsFlag() & this == NORMAL);
 }