internal static void SetSuccessor(PageCursor cursor, long successorId, long stableGeneration, long unstableGeneration) { cursor.Offset = BytePosSuccessor; long result = GenerationSafePointerPair.Write(cursor, successorId, stableGeneration, unstableGeneration); GenerationSafePointerPair.AssertSuccess(result); }
internal static void SetLeftSibling(PageCursor cursor, long leftSiblingId, long stableGeneration, long unstableGeneration) { cursor.Offset = BytePosLeftsibling; long result = GenerationSafePointerPair.Write(cursor, leftSiblingId, stableGeneration, unstableGeneration); GenerationSafePointerPair.AssertSuccess(result); }
/// <summary> /// Checks a read pointer for success/failure and throws appropriate exception with failure information /// if failure. Must be called after a consistent read from page cache (after <seealso cref="PageCursor.shouldRetry()"/>. /// </summary> /// <param name="result"> result from <seealso cref="GenerationSafePointerPair.FLAG_READ"/> or /// <seealso cref="GenerationSafePointerPair.write(PageCursor, long, long, long)"/>. </param> /// <param name="allowNoNode"> If <seealso cref="TreeNode.NO_NODE_FLAG"/> is allowed as pointer value. </param> internal static void CheckPointer(long result, bool allowNoNode) { GenerationSafePointerPair.AssertSuccess(result); if (allowNoNode && !TreeNode.IsNode(result)) { return; } if (result < IdSpace.MIN_TREE_NODE_ID) { throw new TreeInconsistencyException("Pointer to id " + result + " not allowed. Minimum node id allowed is " + IdSpace.MIN_TREE_NODE_ID); } }
internal static void WriteChild(PageCursor cursor, long child, long stableGeneration, long unstableGeneration) { long write = GenerationSafePointerPair.Write(cursor, child, stableGeneration, unstableGeneration); GenerationSafePointerPair.AssertSuccess(write); }