Skip to main content

split_range

Function split_range 

Source
pub fn split_range(
    range: &RangeOwnership,
    split_key: &[u8],
    moved_side: SplitSide,
    moved_id: RangeId,
    target: NodeIdentity,
) -> Result<RangeSplit, SplitError>
Expand description

Divide range at split_key into a retained child and a moved child, with target enlisted as a replica of the moved child so a later MoveRange can hand authority to it.

moved_id is the fresh range id the carved-off subrange takes; it must differ from range’s own id. moved_side selects which child moves: the retained child keeps range’s id (narrowed in place), and the moved child is a brand new entry at epoch/version 1 — its data still lives under the owner until the move cuts over. Fails with SplitError if the split key does not fall strictly inside the range or the moved id collides with the original.