pub fn plan_buckets(
insert_range: TimeRange,
rung: TimeDelta,
finest: TimeDelta,
now: DateTime<Utc>,
grace: TimeDelta,
counts: &[(DateTime<Utc>, i64, i64)],
max_nb_objects: i64,
) -> Vec<PlannedBucket>Expand description
Plans the buckets to materialize over insert_range (rung-aligned) for a query at rung.
A bucket is emitted at rung when it is closed (end <= now - grace, grace absorbing the
commit lag between the insert-time stamp and the row becoming visible) and holds at most
max_nb_objects objects. Otherwise it descends one rung at a time, down to finest, where it
is emitted as is. The open edge is therefore only ever materialized at finest, so every
coarser partition was written while its bucket was closed.
counts holds one entry per non-empty finest-wide bucket, ascending. It may be empty when
insert_range is a single finest bucket: the planner then emits that bucket as non-empty.