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.
32 lines
820 B
Rust
32 lines
820 B
Rust
/// Optional metadata for a commit.
|
|
#[derive(Debug, Default)]
|
|
pub struct CommitOptions {
|
|
pub message: Option<String>,
|
|
pub time: Option<i64>,
|
|
}
|
|
|
|
impl CommitOptions {
|
|
/// Add a message to the commit.
|
|
pub fn with_message<S: Into<String>>(mut self, message: S) -> Self {
|
|
self.message = Some(message.into());
|
|
self
|
|
}
|
|
|
|
/// Add a message to the commit.
|
|
pub fn set_message<S: Into<String>>(&mut self, message: S) -> &mut Self {
|
|
self.message = Some(message.into());
|
|
self
|
|
}
|
|
|
|
/// Add a timestamp to the commit.
|
|
pub fn with_time(mut self, time: i64) -> Self {
|
|
self.time = Some(time);
|
|
self
|
|
}
|
|
|
|
/// Add a timestamp to the commit.
|
|
pub fn set_time(&mut self, time: i64) -> &mut Self {
|
|
self.time = Some(time);
|
|
self
|
|
}
|
|
}
|