You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/docs/concepts/cursor_stable_positions.mdx
+6-13Lines changed: 6 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,11 @@ description: "Understanding cursor and stable position systems in Loro for maint
7
7
8
8
## Quick Reference
9
9
10
-
**Cursors** maintain stable positions across concurrent edits by anchoring to operation IDs instead of indices. Essential for collaborative editing features like shared cursors and persistent annotations.
10
+
**Cursors** maintain stable positions across concurrent edits by anchoring to operation IDs instead of indices. Essential for collaborative editing features like collaborative cursors and persistent annotations.
11
11
12
12
## How It Works
13
13
14
-
Cursors anchor to operation IDs, not indices:
14
+
Cursors anchor to operation IDs and ContainerIDs, not indices:
15
15
16
16
```
17
17
Text: H e l l o W o r l d
@@ -40,9 +40,10 @@ text.insert(0, "ABC");
40
40
const cursor =text.getCursor(1, -1); // Before 'B'
| Tombstone storage | Permanent | Can be garbage collected |
125
124
| Document growth | Linear with all operations | Linear with active operations |
126
125
127
126
### 2. **Faster Local Updates**
128
127
129
128
-**No metadata computation**: Direct index-based operations
130
129
-**No tombstone traversal**: Clean document state
131
-
-**Predictable performance**: O(1) for most local operations
130
+
-**Predictable performance**: O(1) or O(logN) for most local operations
132
131
133
132
### 3. **Efficient Synchronization**
134
133
@@ -184,18 +183,3 @@ The algorithm has been proven to:
184
183
- Maintain strong eventual consistency
185
184
- Preserve all CRDT correctness properties
186
185
- Significantly reduce computational and storage overhead
187
-
188
-
## Key Takeaways
189
-
190
-
1.**Simplicity**: Replace complex metadata with simple indices
191
-
2.**Efficiency**: Replay only what's necessary, when necessary
192
-
3.**Scalability**: Bounded storage growth with safe garbage collection
193
-
4.**Performance**: Fast local operations, efficient synchronization
194
-
5.**Innovation**: Fundamental rethinking of CRDT implementation
195
-
196
-
Eg-Walker represents a breakthrough in collaborative editing technology, making CRDTs more practical and performant for real-world applications. While Loro is not a strict Eg-Walker implementation, it has been profoundly influenced by Eg-Walker's design philosophy and achieves many of the same benefits through this inspiration. By cleverly leveraging the causal history already present in collaborative systems, both Eg-Walker and Loro-inspired approaches achieve the seemingly impossible: simpler data structures with better performance.
0 commit comments