|
|
@ -114,15 +114,18 @@ pub unsafe extern "C" fn full_merge_callback( |
|
|
|
existing_value_len as usize, |
|
|
|
existing_value_len as usize, |
|
|
|
)) |
|
|
|
)) |
|
|
|
}; |
|
|
|
}; |
|
|
|
if let Some(result) = (cb.full_merge_fn)(key, oldval, operands) { |
|
|
|
(cb.full_merge_fn)(key, oldval, operands).map_or_else( |
|
|
|
*new_value_length = result.len() as size_t; |
|
|
|
|| { |
|
|
|
*success = 1_u8; |
|
|
|
*new_value_length = 0; |
|
|
|
Box::into_raw(result.into_boxed_slice()) as *mut c_char |
|
|
|
*success = 0_u8; |
|
|
|
} else { |
|
|
|
ptr::null_mut() as *mut c_char |
|
|
|
*new_value_length = 0; |
|
|
|
}, |
|
|
|
*success = 0_u8; |
|
|
|
|result| { |
|
|
|
ptr::null_mut() as *mut c_char |
|
|
|
*new_value_length = result.len() as size_t; |
|
|
|
} |
|
|
|
*success = 1_u8; |
|
|
|
|
|
|
|
Box::into_raw(result.into_boxed_slice()) as *mut c_char |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub unsafe extern "C" fn partial_merge_callback( |
|
|
|
pub unsafe extern "C" fn partial_merge_callback( |
|
|
@ -138,15 +141,18 @@ pub unsafe extern "C" fn partial_merge_callback( |
|
|
|
let cb = &mut *(raw_cb as *mut MergeOperatorCallback); |
|
|
|
let cb = &mut *(raw_cb as *mut MergeOperatorCallback); |
|
|
|
let operands = &mut MergeOperands::new(operands_list, operands_list_len, num_operands); |
|
|
|
let operands = &mut MergeOperands::new(operands_list, operands_list_len, num_operands); |
|
|
|
let key = slice::from_raw_parts(raw_key as *const u8, key_len as usize); |
|
|
|
let key = slice::from_raw_parts(raw_key as *const u8, key_len as usize); |
|
|
|
if let Some(result) = (cb.partial_merge_fn)(key, None, operands) { |
|
|
|
(cb.partial_merge_fn)(key, None, operands).map_or_else( |
|
|
|
*new_value_length = result.len() as size_t; |
|
|
|
|| { |
|
|
|
*success = 1_u8; |
|
|
|
*new_value_length = 0; |
|
|
|
Box::into_raw(result.into_boxed_slice()) as *mut c_char |
|
|
|
*success = 0_u8; |
|
|
|
} else { |
|
|
|
ptr::null_mut::<c_char>() |
|
|
|
*new_value_length = 0; |
|
|
|
}, |
|
|
|
*success = 0_u8; |
|
|
|
|result| { |
|
|
|
ptr::null_mut::<c_char>() |
|
|
|
*new_value_length = result.len() as size_t; |
|
|
|
} |
|
|
|
*success = 1_u8; |
|
|
|
|
|
|
|
Box::into_raw(result.into_boxed_slice()) as *mut c_char |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub struct MergeOperands { |
|
|
|
pub struct MergeOperands { |
|
|
|