Class LmdbPageCardinalityEstimator

java.lang.Object
org.eclipse.rdf4j.sail.lmdb.estimate.LmdbPageCardinalityEstimator
All Implemented Interfaces:
Closeable, AutoCloseable

public final class LmdbPageCardinalityEstimator extends Object implements Closeable
Transaction-aware facade around the bounded LMDB B+tree range counter.

Callers supply the ID of the already-pinned LMDB read transaction. This class selects the newest valid meta page no newer than that transaction, resolves the requested named database from that same snapshot, and shares decoded pages only among estimates for that snapshot. When the transaction ID or native mapping changes, snapshot(long) installs a fresh cache. This is the boundary that keeps low-level page reads consistent with the logical query view.

The production constructor receives the open LMDB environment so reads can be zero-copy views of LMDB's native map. The file-only constructor intentionally follows the same decoder through positional channel reads and exists for standalone callers and tests. Both paths must produce identical estimates.