For the path to be accurate it needs to be calculated at the moment of op insert not at commit. This is because the path may contain list indexes in parent objects that could change by inserts and deletes later in the transaction. The primary change was adding op_observer to the transaction object and removing it from commit options. The beginnings of a wasm level `applyPatch` system is laid out here.
20 lines
544 B
Rust
20 lines
544 B
Rust
use crate::ChangeHash;
|
|
|
|
/// The result of a successful, and committed, transaction.
|
|
#[derive(Debug)]
|
|
pub struct Success<O, Obs> {
|
|
/// The result of the transaction.
|
|
pub result: O,
|
|
/// The hash of the change, also the head of the document.
|
|
pub hash: ChangeHash,
|
|
pub op_observer: Obs,
|
|
}
|
|
|
|
/// The result of a failed, and rolled back, transaction.
|
|
#[derive(Debug)]
|
|
pub struct Failure<E> {
|
|
/// The error returned from the transaction.
|
|
pub error: E,
|
|
/// The number of operations cancelled.
|
|
pub cancelled: usize,
|
|
}
|