Skip to main content

resolve

Function resolve 

Source
pub fn resolve(
    spec: &PartitionSpec,
    base_start: u64,
    base_end: u64,
) -> Result<Vec<Partition>, String>
Expand description

Resolve a PartitionSpec against a cursor’s base extent [base_start, base_end), producing a list of concrete Partitions with absolute ordinals.

An in window narrows the domain first: the window’s range resolves against the full extent, then the chunking resolves against the window (percentages inside the chunking are window-relative, and the resulting partitions’ base_extent / pct fields are window-based).

For Chunking::SingleRange the result is always a 1-element vector.

For Chunking::DeltaList the deltas are walked left-to-right. Gap entries consume extent without emitting. Tail tokens consume the unallocated remainder: Bound::Star absorbs it as one partition, Bound::Fill repeats the preceding delta until the domain end (final chunk truncated, never dropped), Bound::StarSplit(n) divides it into n near-equal partitions, and Bound::StarShaped(weights) divides it by recipe weights. A sized-delta sum exceeding the extent is a hard error.

Finally, the spec’s PartitionOrder reorders the list for iteration; idx keeps identifying the generation position.

Frames: the window affects sizing and placement only — percentages inside the chunking are window-relative when computing boundaries. The resulting partitions’ start_pct / end_pct / base_extent are always labelled against the full base frame, so a windowed partition re-projected onto another extent (the over clause’s cross-extent contract) keeps its position in the whole domain instead of collapsing the window offset.