Function yrs::ytransaction_apply

source ·
#[no_mangle]
pub unsafe extern "C" fn ytransaction_apply(
    txn: *mut Transaction,
    diff: *const c_char,
    diff_len: u32
) -> u8
Expand description

Applies an diff update (generated by ytransaction_state_diff_v1) to a local transaction’s document.

A length of generated diff binary must be passed within a diff_len out parameter.

Returns an error code in case if transaction succeeded failed:

  • 0: success
  • ERR_CODE_IO (1): couldn’t read data from input stream.
  • ERR_CODE_VAR_INT (2): decoded variable integer outside of the expected integer size bounds.
  • ERR_CODE_EOS (3): end of stream found when more data was expected.
  • ERR_CODE_UNEXPECTED_VALUE (4): decoded enum tag value was not among known cases.
  • ERR_CODE_INVALID_JSON (5): failure when trying to decode JSON content.
  • ERR_CODE_OTHER (6): other error type than the one specified.