mini\Table\Index final class

Documentation

Index factory and key encoding utilities.

For bulk builds (load once, query many times):

$index = Index::fromGenerator(function() use ($table) {
    foreach ($table as $rowId => $row) {
        yield [Index::packInt($row['age']), $rowId];
    }
});

For dynamic insert-heavy workloads, use LsmIndex directly:

$index = new LsmIndex();
$index->insert(Index::packInt($age), $rowId);

Query:

foreach ($index->eq(Index::packInt(25)) as $rowId) { ... }
foreach ($index->range(Index::packInt(18), Index::packInt(65)) as $rowId) { ... }

Methods (8)

Documentation missing

Build index from a generator function.

Build index from array of [key, rowId] pairs.

Pack integer to 8-byte sortable binary

Unpack 8-byte binary to integer

Pack float to 8-byte sortable binary

Unpack 8-byte binary to float

Pack string with optional max length (for fixed-width keys)

Source

src/Table/Index.php:32-131