Yjs state vector

来自WHY42
Riguz留言 | 贡献2024年10月13日 (日) 14:38的版本 (创建页面,内容为“Yjs has the ability to exchange only the differences when syncing two clients. We use lamport timestamps to identify structs and to track in which order a client created them. Each struct has an <syntaxhighlight lang="java" inline>struct.id = { client: number, clock: number}</syntaxhighlight> that uniquely identifies a struct. We define the next expected clock by each client as the state vector. This data structure is similar to the version vectors data structu…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

Yjs has the ability to exchange only the differences when syncing two clients. We use lamport timestamps to identify structs and to track in which order a client created them. Each struct has an struct.id = { client: number, clock: number} that uniquely identifies a struct. We define the next expected clock by each client as the state vector. This data structure is similar to the version vectors data structure. But we use state vectors only to describe the state of the local document, so we can compute the missing struct of the remote client. We do not use it to track causality. [1]