mini\Table\Index\BTreeLeafPage final class

Documentation

Parsed leaf page - stores raw page data and parses lazily.

Uses object pooling to avoid GC overhead during scans.

Page format:

  • Header: type(1) + count(2) + offsets((n+1) * 2) + rowIdCounts(n * 2)
  • Entry: rowIds(8 each) + key - no per-entry metadata

All header metadata unpacked in single call for efficiency. Uses 0-based indexing: offsets at 0..n, rowIdCounts at n+1..2n. Arrays reused via pooling - count tracks valid entries, stale data ignored.

Properties (9)

private static array $pool
private static int $poolCount
public string $data

Raw page data

public int $count

Entry count

public array $meta
public array $entries
public bool $entriesBuilt

Whether entries array is valid for current page data

public array $writeBuffer

Parent internal node (null for root). Not serialized.

Methods (12)

Documentation missing

Build and cache all entries for efficient scan iteration.

Get just the key at 0-based index (for binary search comparisons).

Get single entry by 0-based index (for yielding rowIds after match).

Documentation missing

Serialize to binary page format using precomputed meta.

Calculate the size this page will have when serialized.

Get a leaf page from pool (or create new).

Rebuild meta from current entries array.

Import writeBuffer into entries, maintaining sorted order.

Split this leaf into pages that fit within maxSize.

Create a new leaf page from a batch of entries.

Source

src/Table/Index/BTreeIndex.php:20-445