$database
$database : \Drupal\Core\Database\Connection
Turns the commit index into the buckets a timeline draws.
The aggregation is done in SQL rather than in PHP. A year of history on a busy site is hundreds of thousands of commits, and loading them to add up seven columns would cost more memory than the page has - so the resolution is turned into an integer division inside the query and the database returns one row per bar.
Empty buckets are filled in. A query returns only the buckets that have commits, and a chart drawn from those alone shows a continuous line across a period when nothing happened, which reads as steady activity rather than as silence. So every bucket the window defines is present, and the quiet ones are explicitly empty.
Restores are counted alongside commits because they belong on the same axis: an operator looking at a spike wants to know whether a rollback caused it, and putting the two on separate charts makes that a comparison of x-axes by eye.
$commits : \Drupal\strata\Tree\CommitIndex
__construct(\Drupal\Core\Database\Connection $database, \Drupal\strata\Tree\CommitIndex $commits) : mixed
Constructs a query.
| \Drupal\Core\Database\Connection | $database | The database the indexes live in. |
| \Drupal\strata\Tree\CommitIndex | $commits | Reads individual commits for a drilldown. |
buckets(\Drupal\strata\Timeline\TimelineWindow $window) : list<\Drupal\strata\Timeline\TimelineBucket>
The buckets a window covers, oldest first.
| \Drupal\strata\Timeline\TimelineWindow | $window | The window. |
One bucket per boundary the window defines.
fullHistory(int $fallbackNow) : \Drupal\strata\Timeline\TimelineWindow
The span the whole history covers.
What a timeline opens on when the caller has no window in mind.
| int | $fallbackNow | The unix second to use when there is no history. |
A window over every commit, or over the last hour when there are none.
totals(\Drupal\strata\Timeline\TimelineWindow $window) : array{commits: int, operations: int, raw_bytes: int, stored_bytes: int, anchors: int}
Totals across a whole window, without bucketing.
| \Drupal\strata\Timeline\TimelineWindow | $window | The window. |
The totals.
identifiers(\Drupal\strata\Timeline\TimelineWindow $window) : array<int,list<string>>
A bounded list of commit ids per bucket.
Read as one ordered pass rather than one query per bucket: a window can hold hundreds of buckets, and a query each would be hundreds of round trips for a chart.
| \Drupal\strata\Timeline\TimelineWindow | $window | The window. |
Bucket start keyed to commit ids, newest first.