Open huang12zheng opened 1 year ago
In other words, whether doc_state and state_vector can be split into multiple KVs, then only the updated kv needs to be updated.
let mut diff = Self::diff_state_vectors(&local_sv, sv);
for (client, clock) in diff {
let blocks = self.blocks.get(&client).unwrap();
let start = {
let clock = clock.max(blocks.first().id().clock); // make sure the first id exists
blocks.find_pivot(clock).unwrap()
}
for i in (start + 1)..blocks.len() {
let v = blocks.get(i);
db.set("$name-$client-$i","%v")
}
}
It seems to update doc_state and state_vector in full every time, how can it be incremental?
https://github.com/y-crdt/yrs-persistence/blob/a94b086b987a066d98b7d36a13bd540fca1722ee/yrs-kvstore/src/lib.rs