For b-tree nodes, the key at a given index is larger than the largest key of the child at the same index.
Serialized format: length of a serialized page in bytes (including this field): int check value: short page number (0-based sequential number within a chunk): varInt map id: varInt number of keys: varInt type: byte (0: leaf, 1: node; +2: compressed) children of the non-leaf node (1 more than keys) compressed: bytes saved (varInt) keys values of the leaf node (one for each key)
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static class | |
| private static class | |
| public static class |
| Modifier and Type | Field and Description |
|---|---|
| private int | cachedCompare
The last result of a find operation is cached. |
| private int | diskSpaceUsed
Amount of used disk space by this page only in persistent case. |
| private static final int | IN_MEMORY
Marker value for memory field, meaning that memory accounting is replaced by key count. |
| private K[] | keys
The keys. |
| public final MVMap | map
Map this page belongs to |
| private int | memory
The estimated memory used in persistent case, IN_MEMORY marker value otherwise. |
| pack-priv static final int | PAGE_LEAF_MEMORY
The estimated number of bytes used per empty leaf page. |
| private static final int | PAGE_MEMORY
The estimated number of bytes used per base page. |
| pack-priv static final int | PAGE_MEMORY_CHILD
The estimated number of bytes used per child entry. |
| pack-priv static final int | PAGE_NODE_MEMORY
The estimated number of bytes used per empty internal page object. |
| public int | pageNo
Sequential 0-based number of the page within containing chunk. |
| private volatile long | pos
Position of this page's saved image within a Chunk or 0 if this page has not been saved yet or 1 if this page has not been saved yet, but already removed This "removed" flag is to keep track of pages that concurrently changed while they are being stored, in which case the live bookkeeping needs to be aware of this fact. |
| private static final AtomicLongFieldUpdater | posUpdater
Updater for pos field, which can be updated when page is saved, but can be concurrently marked as removed |
| private static final Page. |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv final void | |
| pack-priv int | Returns: the value or nullthe key key)Search the key in this page using a binary search. |
| protected int | |
| protected final Page | |
| pack-priv abstract Page | |
| public final Page | |
| pack-priv static < key type K, value type V> Page | |
| pack-priv static < key type K, value type V> Page | |
| public final K[] | |
| pack-priv static < key type K, value type V> Page | Returns: the pagethe map map, K[] the keys keys, V[] the values values, int the memory used in bytes memory)Create a new leaf page. |
| public static < the key class K, the value class V> Page | Returns: the pagethe map map, K[] the keys keys, Page.the child page positions children,the total number of keys totalCount, int the memory used in bytes memory)Create a new non-leaf page. |
| public static < the key class K, the value class V> Page. | Returns: the arraythe number of entries size)Create an array of page references. |
| pack-priv final V[] | |
| protected void | |
| pack-priv abstract void | expand(int
number of mappings to be added extraKeyCount, K[] to be added extraKeys, V[] to be added extraValues)Append additional key/value mappings to this Page. |
| pack-priv final void | expandKeys(int
number of extra key entries to create extraKeyCount, K[] extra key values extraKeys)Expand the keys array. |
| pack-priv static < key type K, value type V> V | |
| public abstract CursorPos | Returns: new head of the CursorPos chainpresumably pointing to this Page (null if real root), to build upon cursorPos)Extend path from a given CursorPos chain to "append point" in a B-tree, rooted at this Page. |
| public abstract Page | |
| public abstract long | |
| pack-priv abstract long | Returns: the descendant countthe child index index)Get the number of key-value pairs for a given child. |
| public final long | Returns: amount of used disk space in persistent casetrue to return quick approximationAmount of used disk space in persistent case including child pages. |
| private long | |
| private long | |
| public K | |
| public final int | |
| public final int | |
| public final int | |
| public abstract int | |
| public final long | |
| public abstract CursorPos | Returns: new head of the CursorPos chainpresumably pointing to this Page (null if real root), to build upon cursorPos)Extend path from a given CursorPos chain to "prepend point" in a B-tree, rooted at this Page. |
| public abstract int | |
| public abstract long | Returns: the number of key-value pairsGet the total number of key-value pairs, including child pages. |
| public abstract V | |
| private void | |
| pack-priv final void | |
| public abstract void | insertLeaf(int
the index index, K the key key, V the value value)Insert a key-value pair into this leaf. |
| public abstract void | insertNode(int
the index index, K the key key, Page<K, V> the child page childPage)Insert a child page into this node. |
| public boolean | |
| public final boolean | |
| protected final boolean | |
| public final boolean | |
| public final boolean | |
| private boolean | Returns: true if it was marked by this call or has been marked already, false if page has been saved already.Mark this page as removed "in memory". |
| pack-priv static < key type K, value type V> Page | Returns: the pageByteBuffer containing serialized page info buff, long the position pos, MVMap<K, V> the map map)Read a page. |
| private void | |
| protected abstract void | |
| pack-priv final void | |
| pack-priv abstract void | |
| public void | |
| public abstract int | Returns: adjustment for "unsaved memory" amountat which page got removed version)Remove all page data recursively. |
| public final int | Returns: amount (negative), by which "unsaved memory" should be adjusted, if page is unsaved one, and 0 for page that was already saved, or in case of non-persistent mapat which page was removed version)Make accounting changes (chunk occupancy or "unsaved" RAM), related to this page removal. |
| public abstract void | |
| public void | |
| public final void | |
| public abstract V | Returns: the old valuethe index index, V the new value value)Replace the value at an index in this page. |
| pack-priv abstract Page | |
| pack-priv final K[] | Returns: the second array.size of the first array. aCount, int size of the second array/ bCount)Split the current keys array into two arrays. |
| public String | |
| protected final int | Returns: the position of the buffer, where serialized child page references (if any) beginwhich provides a target buffer
and can be queried for various attributes
related to serialization pageSerializationManagerSerializes this page into provided buffer, which represents content of the specified chunk to be persisted and updates the "position" of the page. |
| protected abstract void | writeChildren(WriteBuffer
the target buffer buff, boolean true if the descendant counts should be written withCounts)Write page children to the buff. |
| pack-priv abstract void | writeUnsavedRecursive(FileStore.
which provides a target buffer
and can be queried for various attributes
related to serialization pageSerializationManagerStore this page and all children that are changed, in reverse order, and update the position and the children. |
| protected abstract void |