MediaWiki master
MediaWiki\RecentChanges\ChangesListQuery\TimestampRangePartitioner Class Reference

The mathematical bits of partitioning a query by timestamp range. More...

Public Member Functions

 __construct (private int $minTime, private int $now, private int $limit, private int|float|null $rateEstimate, private int|float $densityEstimate, private int|float $rcSize, private int|float $rcMaxAge,)
 
 getMetrics ()
 Get metrics describing the overall partitioning operation.
 
 getMinFoundTime ()
 
 getNextPartition ()
 Get the minimum timestamp, optional maximum timestamp and query limit for the next partitioned query.
 
 isDone ()
 Check whether the overall set of queries is done.
 
 notifyResult (?int $earliestFound, int $numRows)
 Call this to tell us about the rows that were found by the query specified by the previous call to getNextPartition().
 

Detailed Description

The mathematical bits of partitioning a query by timestamp range.

Avoid dependencies so that this class is easily unit testable.

Access: internal
For use by ChangesListQuery
Since
1.45

Definition at line 14 of file TimestampRangePartitioner.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\RecentChanges\ChangesListQuery\TimestampRangePartitioner::__construct ( private int $minTime,
private int $now,
private int $limit,
private int|float|null $rateEstimate,
private int|float $densityEstimate,
private int|float $rcSize,
private int|float $rcMaxAge )
Parameters
int$minTimeThe user-specified timestamp cutoff (UNIX time)
int$nowThe maximum UNIX timestamp, conventionally the current time.
int$limitThe maximum number of rows to find
int | float | null$rateEstimateThe query rate (rows/second) if available
int | float$densityEstimateAn estimate of the query density. The number of rows returned per row scanned. The probability that the conditions will match.
int | float$rcSizeThe total number of rows in the table
int | float$rcMaxAgeThe maximum age of rows in the table

Definition at line 69 of file TimestampRangePartitioner.php.

Member Function Documentation

◆ getMetrics()

MediaWiki\RecentChanges\ChangesListQuery\TimestampRangePartitioner::getMetrics ( )

Get metrics describing the overall partitioning operation.

Returns
array
  • queryCount: The number of queries done
  • actualPeriod: The period covered by the returned rows, in seconds
  • queryPeriod: The period covered by the query conditions, in seconds
  • actualRows: The total number of rows found

Definition at line 139 of file TimestampRangePartitioner.php.

◆ getMinFoundTime()

MediaWiki\RecentChanges\ChangesListQuery\TimestampRangePartitioner::getMinFoundTime ( )

Definition at line 148 of file TimestampRangePartitioner.php.

◆ getNextPartition()

MediaWiki\RecentChanges\ChangesListQuery\TimestampRangePartitioner::getNextPartition ( )

Get the minimum timestamp, optional maximum timestamp and query limit for the next partitioned query.

Returns
array{int,?int,int}

Definition at line 86 of file TimestampRangePartitioner.php.

◆ isDone()

MediaWiki\RecentChanges\ChangesListQuery\TimestampRangePartitioner::isDone ( )

Check whether the overall set of queries is done.

Returns
bool

Definition at line 125 of file TimestampRangePartitioner.php.

◆ notifyResult()

MediaWiki\RecentChanges\ChangesListQuery\TimestampRangePartitioner::notifyResult ( ?int $earliestFound,
int $numRows )

Call this to tell us about the rows that were found by the query specified by the previous call to getNextPartition().

Parameters
int | null$earliestFoundThe earliest found UNIX timestamp
int$numRowsThe number of rows found

Definition at line 112 of file TimestampRangePartitioner.php.


The documentation for this class was generated from the following file: