/// <summary> /// How do we best rebalance left and right leaf? /// Can we move keys from underflowing left to right so that none of them underflow? </summary> /// <returns> 0, do nothing. -1, merge. 1-inf, move this number of keys from left to right. </returns> internal abstract int CanRebalanceLeaves(PageCursor leftCursor, int leftKeyCount, PageCursor rightCursor, int rightKeyCount);
internal override bool ReadValue(PageCursor cursor, int size, GenericKey into) { return(Read(cursor, into)); }
internal static bool Read(PageCursor cursor, GenericKey into) { into.WriteLocalDateTime(cursor.Long, cursor.Int); return(true); }
internal abstract void AssertAdditionalHeader(PageCursor cursor, TreeNode <KEY, VALUE> node, int pageSize);
internal override void PutValue(PageCursor cursor, GenericKey state) { cursor.PutByte(( sbyte )state.Long1); PutArray(cursor, state, NumberArrayElementWriter(state)); }
private static void OverwriteGSPP(PageCursor cursor, int gsppOffset, long generation, long pointer) { cursor.Offset = gsppOffset; GenerationSafePointer.Write(cursor, generation, pointer); GenerationSafePointer.Clean(cursor); }
private long LeftSibling(PageCursor cursor, long stableGeneration, long unstableGeneration) { return(pointer(TreeNode.LeftSibling(cursor, stableGeneration, unstableGeneration))); }
// Useful for debugging //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unused") abstract void printNode(org.neo4j.io.pagecache.PageCursor cursor, boolean includeValue, boolean includeAllocSpace, long stableGeneration, long unstableGeneration); internal abstract void PrintNode(PageCursor cursor, bool includeValue, bool includeAllocSpace, long stableGeneration, long unstableGeneration);
/// <returns> <seealso cref="string"/> describing inconsistency of empty string "" if no inconsistencies. </returns> internal abstract string CheckMetaConsistency(PageCursor cursor, int keyCount, Type type, GBPTreeConsistencyCheckVisitor <KEY> visitor);
/// <summary> /// Move all rightmost keys and values in left leaf from given position to right leaf. /// /// Right leaf will be defragmented. /// /// Update keyCount in left and right. /// </summary> internal abstract void MoveKeyValuesFromLeftToRight(PageCursor leftCursor, int leftKeyCount, PageCursor rightCursor, int rightKeyCount, int fromPosInLeftNode);
/// <summary> /// Copy all keys and values in left leaf and insert to the left in right leaf. /// /// Right leaf will be defragmented. /// /// Update keyCount in right /// </summary> internal abstract void CopyKeyValuesFromLeftToRight(PageCursor leftCursor, int leftKeyCount, PageCursor rightCursor, int rightKeyCount);
/// <summary> /// Performs the entry moving part of split in internal. /// /// Keys and children from left is divided between left and right and the new key and child is inserted where it belongs. /// /// Key count is updated. /// </summary> internal abstract void DoSplitInternal(PageCursor leftCursor, int leftKeyCount, PageCursor rightCursor, int insertPos, KEY newKey, long newRightChild, long stableGeneration, long unstableGeneration, KEY newSplitter, double ratioToKeepInLeftOnSplit);
/// <summary> /// Calculate where split should be done and move entries between leaves participating in split. /// /// Keys and values from left are divide between left and right and the new key and value is inserted where it belongs. /// /// Key count is updated. /// </summary> internal abstract void DoSplitLeaf(PageCursor leftCursor, int leftKeyCount, PageCursor rightCursor, int insertPos, KEY newKey, VALUE newValue, KEY newSplitter, double ratioToKeepInLeftOnSplit);
internal abstract bool CanMergeLeaves(PageCursor leftCursor, int leftKeyCount, PageCursor rightCursor, int rightKeyCount);
public abstract void WriteValue(PageCursor cursor, VALUE value);
internal static sbyte NodeType(PageCursor cursor) { return(cursor.GetByte(BYTE_POS_NODE_TYPE)); }
public abstract void WriteKey(PageCursor cursor, KEY key);
internal virtual void InitializeLeaf(PageCursor cursor, long stableGeneration, long unstableGeneration) { WriteBaseHeader(cursor, LEAF_FLAG, stableGeneration, unstableGeneration); WriteAdditionalHeader(cursor); }
private void Initialize() { _currentPageId = UNBOUND_PAGE_ID; _current = null; }
/// <summary> /// Copy the specified number of bytes from the given offset of this page, to the given offset of the target page. /// <para> /// If the length reaches beyond the end of either cursor, then only as many bytes as are available in this cursor, /// or can fit in the target cursor, are actually copied. /// </para> /// <para> /// <strong>Note</strong> that {@code copyTo} is only guaranteed to work when both target and source cursor are from /// the <em>same</em> page cache implementation. Using wrappers, delegates or mixing cursor implementations may /// produce unspecified errors. /// /// </para> /// </summary> /// <param name="sourceOffset"> The offset into this page to copy from. </param> /// <param name="targetCursor"> The cursor the data will be copied to. </param> /// <param name="targetOffset"> The offset into the target cursor to copy to. </param> /// <param name="lengthInBytes"> The number of bytes to copy. </param> /// <returns> The number of bytes actually copied. </returns> public abstract int CopyTo(int sourceOffset, PageCursor targetCursor, int targetOffset, int lengthInBytes);
private long Successor(PageCursor cursor, long stableGeneration, long unstableGeneration) { return(pointer(TreeNode.Successor(cursor, stableGeneration, unstableGeneration))); }
public abstract void ReadMetaData(PageCursor cursor);
internal override bool ReadValue(PageCursor cursor, int size, GenericKey into) { readCrs(cursor, into); return(ReadArray(cursor, Org.Neo4j.Values.Storable.ValueWriter_ArrayType.Point, GeometryArrayType.readGeometryArrayItem, into)); }
public abstract void WriteMetaData(PageCursor cursor);
internal override void PutValue(PageCursor cursor, GenericKey state) { Put(cursor, state.Long0, state.Long1); }
public abstract void ReadValue(PageCursor cursor, VALUE into, int valueSize);
internal static void Put(PageCursor cursor, long long0, long long1) { cursor.PutLong(long1); cursor.PutInt(( int )long0); }
public abstract void ReadKey(PageCursor cursor, KEY into, int keySize);
private void ReadFormatVersion(PageCursor c) { c.Int; // Major version c.Int; // Minor version }
internal abstract bool LeafUnderflow(PageCursor cursor, int keyCount);