org.h2.pagestore.db

## Class PageDataNode

- java.lang.Object
- - org.h2.util.CacheObject
  - - org.h2.pagestore.Page
    - - org.h2.pagestore.db.PageDataNode

All Implemented Interfaces:
  java.lang.Comparable<CacheObject>

    public class PageDataNode
    extends Page

A leaf page that contains data of one or multiple rows. Format:

- page type: byte (0)
- checksum: short (1-2)
- parent page id (0 for root): int (3-6)
- table id: varInt
- count of all children (-1 if not known): int
- entry count: short
- rightmost child page id: int
- entries (child page id: int, key: varLong)

The key is the largest key of the respective child, meaning key[0] is the largest key of child[0].

### Field Summary

Fields
`protected Data` `data` The data page.
`protected int` `entryCount` The number of entries.
`protected PageDataIndex` `index` The index.
`protected long[]` `keys` The row keys.
`protected int` `parentPageId` The page number of the parent.
`protected boolean` `written` Whether the data page is up-to-date.

### Fields inherited from class org.h2.pagestore.Page

`changeCount, FLAG_LAST, TYPE_BTREE_LEAF, TYPE_BTREE_NODE, TYPE_DATA_LEAF, TYPE_DATA_NODE, TYPE_DATA_OVERFLOW, TYPE_EMPTY, TYPE_FREE_LIST, TYPE_STREAM_DATA, TYPE_STREAM_TRUNK`

### Fields inherited from class org.h2.util.CacheObject

`cacheChained, cacheNext, cachePrevious`

### Method Summary

Methods
`boolean` `canRemove()` Check if the object can be removed from the cache.
`int` `getMemory()` Get the estimated heap memory size.
`void` `moveTo(Session session, int newPos)` Copy the data to a new location, change the parent to point to the new location, and free up the current page.
`static Page` `read(PageDataIndex index, Data data, int pageId)` Read a data node page.
`protected void` `remapChildren(int old)` Update the parent id of all children.
`java.lang.String` `toString()`
`void` `write()` Write the page.

### Methods inherited from class org.h2.pagestore.Page

`add, canMove, insert, insert, insert, remove, remove, remove`

### Methods inherited from class org.h2.util.CacheObject

`compareTo, getPos, isChanged, isStream, setChanged, setPos`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### index

    protected final PageDataIndex index

The index.

#### parentPageId

    protected int parentPageId

The page number of the parent.

#### data

    protected final Data data

The data page.

#### entryCount

    protected int entryCount

The number of entries.

#### keys

    protected long[] keys

The row keys.

#### written

    protected boolean written

Whether the data page is up-to-date.

### Method Detail

#### read

    public static Page read(PageDataIndex index,
            Data data,
            int pageId)

Read a data node page.

Parameters:
  `index` - the index
  `data` - the data
  `pageId` - the page id
Returns:
  the page

#### remapChildren

    protected void remapChildren(int old)

Update the parent id of all children.

Parameters:
  `old` - the previous position

#### write

    public void write()

Description copied from class: `Page`
Write the page.

Specified by:
  `write` in class `Page`

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### moveTo

    public void moveTo(Session session,
              int newPos)

Description copied from class: `Page`
Copy the data to a new location, change the parent to point to the new location, and free up the current page.

Specified by:
  `moveTo` in class `Page`
Parameters:
  `session` - the session
  `newPos` - the new position

#### getMemory

    public int getMemory()

Get the estimated heap memory size.

Specified by:
  `getMemory` in class `CacheObject`
Returns:
  number of double words (4 bytes each)

#### canRemove

    public boolean canRemove()

Description copied from class: `CacheObject`
Check if the object can be removed from the cache. For example pinned objects can not be removed.

Specified by:
  `canRemove` in class `CacheObject`
Returns:
  true if it can be removed