pub fn split_range(
ranges: &[AvailableRange],
requested_start: u64,
requested_end: u64,
) -> Result<Vec<(u64, u64)>, String>Expand description
Split a user-requested [start_slot, end_slot] range across the available
bundle ranges, returning a list of contiguous, non-overlapping (start, end)
pairs — one per bundle that the server can serve as its own session.
Each emitted start is a real bundle_start_slot and each end is within
the max_bundle_end_slot of a bundle that begins exactly at that start
(the server requires start_slot == bundle_start_slot and caps end_slot at
that bundle’s max_bundle_end_slot). Among all such gap-free splits we pick
the one with the most sub-ranges, i.e. the highest parallelism: a fine-grained
(e.g. 10k) bundle grid yields one session per fine bundle instead of
collapsing onto a coarser series that overlaps the same slots — even when the
coarse and fine bundles share a start slot. A coarser bundle is only ridden
where no finer grid continues the walk, which still lets us serve a request
the coarse data covers even across a hole in the fine grid.
Returns an error if the requested start slot is not a bundle start, or if no
gap-free split reaches requested_end.