Function yrs::ytransaction_state_diff_v1
source · #[no_mangle]
pub unsafe extern "C" fn ytransaction_state_diff_v1(
txn: *const Transaction,
sv: *const c_char,
sv_len: u32,
len: *mut u32
) -> *mut c_char
Expand description
Returns a delta difference between current state of a transaction’s document and a state vector
sv
encoded as a binary payload using lib0 version 1 encoding (which could be generated using
ytransaction_state_vector_v1). Such delta can be send back to the state vector’s sender in
order to propagate and apply (using ytransaction_apply) all updates known to a current
document, which remote peer was not aware of.
If passed sv
pointer is null, the generated diff will be a snapshot containing entire state of
the document.
A length of an encoded state vector payload must be passed as sv_len
parameter.
A length of generated delta diff binary will be passed within a len
out parameter.
Once no longer needed, a returned binary can be disposed using ybinary_destroy function.