Class Page.NonLeaf<K,V>
java.lang.Object
org.h2.mvstore.Page<K,V>
org.h2.mvstore.Page.NonLeaf<K,V>
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
Page.IncompleteNonLeaf
-
Nested Class Summary
Nested classes/interfaces inherited from class Page
Page.PageReference<K,V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Page.PageReference<K,V>[] The child page references.private longThe total entry count of this page and all children.Fields inherited from class Page
map, PAGE_LEAF_MEMORY, PAGE_MEMORY_CHILD, PAGE_NODE_MEMORY, pageNo -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intCalculate estimated memory used in persistent case.private longCreate a copy of this page with potentially different owning map.voiddump(StringBuilder buff) Dump debug data for this page.voidAppend additional key/value mappings to this Page.getAppendCursorPos(CursorPos<K, V> cursorPos) Extend path from a given CursorPos chain to "append point" in a B-tree, rooted at this Page.getChildPage(int index) Get the child page at the given index.longgetChildPagePos(int index) Get the position of the child.(package private) longgetCounts(int index) Get the number of key-value pairs for a given child.intgetPrependCursorPos(CursorPos<K, V> cursorPos) Extend path from a given CursorPos chain to "prepend point" in a B-tree, rooted at this Page.intlongGet the total number of key-value pairs, including child pages.getValue(int index) Get the value at the given index.voidinsertLeaf(int index, K key, V value) Insert a key-value pair into this leaf.voidinsertNode(int index, K key, Page<K, V> childPage) Insert a child page into this node.protected voidreadPayLoad(ByteBuffer buff) Read the page payload from the buffer.(package private) void(package private) voidUnlink the children recursively after all data is written.voidremove(int index) Remove the key and value (or child) at the given index.intremoveAllRecursive(long version) Remove all page data recursively.voidReplace the child page.Replace the value at an index in this page.split(int at) Split the page.protected voidwriteChildren(WriteBuffer buff, boolean withCounts) Write page children to the buff.(package private) voidwriteChildrenRecursive(Chunk chunk, WriteBuffer buff, List<Long> toc) (package private) voidwriteUnsavedRecursive(Chunk chunk, WriteBuffer buff, List<Long> toc) Store this page and all children that are changed, in reverse order, and update the position and the children.protected voidwriteValues(WriteBuffer buff) Write values that the buffer contains to the buff.Methods inherited from class Page
addMemory, binarySearch, clone, copy, createEmptyLeaf, createEmptyNode, createKeyStorage, createLeaf, createNode, createRefStorage, createValueStorage, expandKeys, get, getDiskSpaceUsed, getKey, getKeyCount, getMapId, getMemory, getPos, insertKey, isComplete, isLeaf, isPersistent, isRemoved, isSaved, read, recalculateMemory, removePage, setComplete, setKey, splitKeys, toString, write
-
Field Details
-
children
The child page references. -
totalCount
private long totalCountThe total entry count of this page and all children.
-
-
Constructor Details
-
NonLeaf
-
NonLeaf
NonLeaf(MVMap<K, V> map, Page.NonLeaf<K, V> source, Page.PageReference<K, V>[] children, long totalCount) -
NonLeaf
-
-
Method Details
-
getNodeType
public int getNodeType()- Specified by:
getNodeTypein classPage<K,V>
-
copy
Description copied from class:PageCreate a copy of this page with potentially different owning map. This is used exclusively during bulk map copying. Child page references for nodes are cleared (re-pointed to an empty page) to be filled-in later to copying procedure. This way it can be saved mid-process without tree integrity violation -
getChildPage
-
getChildPagePos
public long getChildPagePos(int index) Description copied from class:PageGet the position of the child.- Specified by:
getChildPagePosin classPage<K,V> - Parameters:
index- the index- Returns:
- the position
-
getValue
-
split
-
expand
Description copied from class:PageAppend additional key/value mappings to this Page. New mappings suppose to be in correct key order. -
getTotalCount
public long getTotalCount()Description copied from class:PageGet the total number of key-value pairs, including child pages.- Specified by:
getTotalCountin classPage<K,V> - Returns:
- the number of key-value pairs
-
calculateTotalCount
private long calculateTotalCount() -
recalculateTotalCount
void recalculateTotalCount() -
getCounts
-
setChild
-
setValue
-
insertLeaf
-
insertNode
-
remove
-
removeAllRecursive
public int removeAllRecursive(long version) Description copied from class:PageRemove all page data recursively.- Specified by:
removeAllRecursivein classPage<K,V> - Parameters:
version- at which page got removed- Returns:
- adjustment for "unsaved memory" amount
-
getPrependCursorPos
Description copied from class:PageExtend path from a given CursorPos chain to "prepend point" in a B-tree, rooted at this Page.- Specified by:
getPrependCursorPosin classPage<K,V> - Parameters:
cursorPos- presumably pointing to this Page (null if real root), to build upon- Returns:
- new head of the CursorPos chain
-
getAppendCursorPos
Description copied from class:PageExtend path from a given CursorPos chain to "append point" in a B-tree, rooted at this Page.- Specified by:
getAppendCursorPosin classPage<K,V> - Parameters:
cursorPos- presumably pointing to this Page (null if real root), to build upon- Returns:
- new head of the CursorPos chain
-
readPayLoad
Description copied from class:PageRead the page payload from the buffer.- Specified by:
readPayLoadin classPage<K,V> - Parameters:
buff- the buffer
-
writeValues
Description copied from class:PageWrite values that the buffer contains to the buff.- Specified by:
writeValuesin classPage<K,V> - Parameters:
buff- the target buffer
-
writeChildren
Description copied from class:PageWrite page children to the buff.- Specified by:
writeChildrenin classPage<K,V> - Parameters:
buff- the target bufferwithCounts- true if the descendant counts should be written
-
writeUnsavedRecursive
Description copied from class:PageStore this page and all children that are changed, in reverse order, and update the position and the children.- Specified by:
writeUnsavedRecursivein classPage<K,V> - Parameters:
chunk- the chunkbuff- the target buffertoc- prospective table of content
-
writeChildrenRecursive
-
releaseSavedPages
void releaseSavedPages()Description copied from class:PageUnlink the children recursively after all data is written.- Specified by:
releaseSavedPagesin classPage<K,V>
-
getRawChildPageCount
public int getRawChildPageCount()- Specified by:
getRawChildPageCountin classPage<K,V>
-
calculateMemory
protected int calculateMemory()Description copied from class:PageCalculate estimated memory used in persistent case.- Overrides:
calculateMemoryin classPage<K,V> - Returns:
- memory in bytes
-
dump
-