Package org.h2.mvstore
Class Page.Leaf<K,V>
java.lang.Object
org.h2.mvstore.Page<K,V>
org.h2.mvstore.Page.Leaf<K,V>
- All Implemented Interfaces:
Cloneable
-
Nested Class Summary
Nested classes/interfaces inherited from class org.h2.mvstore.Page
Page.PageReference<K,V> -
Field Summary
FieldsFields inherited from class org.h2.mvstore.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.Create 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) 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.private VsetValueInternal(int index, V value) split(int at) Split the page.protected voidwriteChildren(WriteBuffer buff, boolean withCounts) Write page children to the buff.(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 org.h2.mvstore.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
-
values
The storage for values.
-
-
Constructor Details
-
Leaf
-
Leaf
-
Leaf
-
-
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
Description copied from class:PageGet the child page at the given index.- Specified by:
getChildPagein classPage<K,V> - Parameters:
index- the index- Returns:
- the child page
-
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
Description copied from class:PageGet the value at the given index. -
split
Description copied from class:PageSplit the page. This modifies the current page. -
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
-
getCounts
long getCounts(int index) Description copied from class:PageGet the number of key-value pairs for a given child. -
setChild
Description copied from class:PageReplace the child page. -
setValue
Description copied from class:PageReplace the value at an index in this page. -
setValueInternal
-
insertLeaf
Description copied from class:PageInsert a key-value pair into this leaf.- Specified by:
insertLeafin classPage<K,V> - Parameters:
index- the indexkey- the keyvalue- the value
-
insertNode
Description copied from class:PageInsert a child page into this node.- Specified by:
insertNodein classPage<K,V> - Parameters:
index- the indexkey- the keychildPage- the child page
-
remove
public void remove(int index) Description copied from class:PageRemove the key and value (or child) at the given index. -
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
-
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
Description copied from class:PageDump debug data for this page.
-