/// <summary> /// Moves data from right to left to remove a slot where data that should be deleted currently sits. /// Key count is NOT updated! /// </summary> /// <param name="cursor"> Write cursor on relevant page </param> /// <param name="pos"> Logical position where slots should be inserted, pos is based on baseOffset and slotSize. </param> /// <param name="totalSlotCount"> How many slots there are in total. (Usually keyCount for keys and values or keyCount+1 for children). </param> /// <param name="baseOffset"> Offset to slot in logical position 0. </param> /// <param name="slotSize"> Size of one single slot. </param> internal static void RemoveSlotAt(PageCursor cursor, int pos, int totalSlotCount, int baseOffset, int slotSize) { cursor.ShiftBytes(baseOffset + (pos + 1) * slotSize, (totalSlotCount - (pos + 1)) * slotSize, -slotSize); }
// BODY METHODS /// <summary> /// Moves data from left to right to open up a gap where data can later be written without overwriting anything. /// Key count is NOT updated! /// </summary> /// <param name="cursor"> Write cursor on relevant page </param> /// <param name="pos"> Logical position where slots should be inserted, pos is based on baseOffset and slotSize. </param> /// <param name="numberOfSlots"> How many slots to be inserted. </param> /// <param name="totalSlotCount"> How many slots there are in total. (Usually keyCount for keys and values or keyCount+1 for children). </param> /// <param name="baseOffset"> Offset to slot in logical position 0. </param> /// <param name="slotSize"> Size of one single slot. </param> internal static void InsertSlotsAt(PageCursor cursor, int pos, int numberOfSlots, int totalSlotCount, int baseOffset, int slotSize) { cursor.ShiftBytes(baseOffset + pos * slotSize, (totalSlotCount - pos) * slotSize, numberOfSlots * slotSize); }