47 lines
1.3 KiB
Text
47 lines
1.3 KiB
Text
collabd design notes
|
|
|
|
two possible sync modes
|
|
-----------------------
|
|
|
|
1. text-crdt mode (current implementation)
|
|
|
|
uses yjs for proper text crdt operations. handles insertions, deletions,
|
|
concurrent edits with automatic conflict resolution. supports all the
|
|
stuff editors expect: select, cut, paste, undo per user.
|
|
|
|
pros:
|
|
- real editor behavior
|
|
- proper undo/redo
|
|
- handles complex concurrent edits
|
|
|
|
cons:
|
|
- more complex
|
|
- yjs overhead
|
|
- adapters need to translate buffer ops to crdt ops
|
|
|
|
2. cell-grid mode (simpler alternative)
|
|
|
|
treat document as 2d grid of cells at (row, col). each cell is one
|
|
character. last write wins (or use timestamps per cell).
|
|
|
|
basically: shared terminal buffer.
|
|
|
|
pros:
|
|
- dead simple
|
|
- no crdt library needed
|
|
- works great for terminal-native use cases
|
|
- less adapter complexity
|
|
|
|
cons:
|
|
- no cut/paste (moving cells is weird)
|
|
- no semantic operations (select word, delete line)
|
|
- undo is per-cell, not per-action
|
|
- inserting char doesnt shift rest of line
|
|
|
|
good for: shared scratch buffer, terminal notepad, mob viewing
|
|
bad for: actual code editing
|
|
|
|
could support both modes and let adapters pick. text-crdt for real editors,
|
|
cell-grid for simpler/terminal-only tools.
|
|
|
|
jquast suggested this approach - worth keeping in mind for mvp simplicity.
|