// Assumes that the two extents to be merged are on adjacent layers (i.e. layers N, N+1).
Assumes that the two extents to be merged are on adjacent layers .
Assumes that the two extents to be merged are on adjacent layers .
fn merge_deleted_extents<'a>(
    object_id: u64,
    attribute_id: u64,
    left_key: &ExtentKey,
    right_key: &ExtentKey,
) -> MergeResult<ObjectKey, ObjectValue> {
    if left_key.range.end < right_key.range.start {
        // The extents are not adjacent or overlapping.
        return MergeResult::EmitLeft;
    }
    // Both of these are deleted extents which are either adjacent or overlapping, which means
    // we can coalece the records.
    if left_key.range.end >= right_key.range.end {
        // The left deletion eclipses the right, so just keep the left.
        return MergeResult::Other { emit: None, left: Keep, right: Discard };
    }
    MergeResult::Other {
        emit: None,
        left: Discard,
        right: Replace(ObjectItem::new(
            ObjectKey::extent(object_id, attribute_id, left_key.range.start..right_key.range.end),
            ObjectValue::deleted_extent(),
        )),
    }
}
fn merge_deleted_extents < ' a > ( object_id : u64 , attribute_id : u64 , left_key : & ExtentKey , right_key : & ExtentKey , ) -> MergeResult < ObjectKey , ObjectValue > { if left_key . range . end < right_key . range . start { // The extents are not adjacent or overlapping. return MergeResult :: EmitLeft ; } // Both of these are deleted extents which are either adjacent or overlapping, which means // we can coalece the records. if left_key . range . end >= right_key . range . end { // The left deletion eclipses the right, so just keep the left. return MergeResult :: Other { emit : None , left : Keep , right : Discard } ; } MergeResult :: Other { emit : None , left : Discard , right : Replace ( ObjectItem :: new ( ObjectKey :: extent ( object_id , attribute_id , left_key . range . start .. right_key . range . end ) , ObjectValue :: deleted_extent ( ) , ) ) , } }
Assumes that the two extents to be merged are on adjacent layers (i.e.
Assumes that the two extents to be merged are on adjacent layers ( i . e .
object_id
u64
attribute_id
u64
left_key
&ExtentKey
right_key
&ExtentKey