mini\Table\Index\TreapIndex
final
class
Documentation
Hybrid hash/sorted-array/treap index optimized for real-world access patterns.
Three stages based on usage:
- Hash only: eq() lookups, no range yet
- Sorted array: first range() called, assume no more inserts
- Treap: insert after range, convert sorted→treap once, stay in treap
This avoids merge overhead by using only one structure at a time for range().
Inheritance
Implements:
mini\Table\Index\IndexInterface
mini\Table\Index\HashIndexInterface
Constants (3)
| Name | Value |
|---|---|
MODE_HASH |
0 |
MODE_SORTED |
1 |
MODE_TREAP |
2 |
Properties (4)
array $hash
int $mode
array $sorted
Methods (21)
Build index from a generator function.
Build index from array of [key, rowId] pairs.
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Count rowIds for a specific key.
Count unique keys.
Count total rowIds across all keys.
Clear all data from the index.
Count rowIds in a range.
Documentation missing
Convert sorted array to treap (called on first insert after range).
Build balanced treap from sorted keys.
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Treap range with blob yielding (iterative, strict pruning).
Documentation missing
Documentation missing