Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
The Science of Etherpad
Search
Tim Cameron Ryan
May 14, 2012
Programming
2
61
The Science of Etherpad
How does Operational Transform work?
Tim Cameron Ryan
May 14, 2012
Tweet
Share
More Decks by Tim Cameron Ryan
See All by Tim Cameron Ryan
BayNode Meetup June 2014
tcr
1
78
Elevator redesign: Team Unibros Final Presentation
tcr
0
420
Other Decks in Programming
See All in Programming
Jakarta EE meets AI
ivargrimstad
0
800
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
130
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
680
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
110
みんなでプロポーザルを書いてみた
yuriko1211
0
290
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
110
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
受け取る人から提供する人になるということ
little_rubyist
0
260
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
230
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
270
Jakarta EE meets AI
ivargrimstad
0
870
Click-free releases & the making of a CLI app
oheyadam
2
120
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
693
190k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
Practical Orchestrator
shlominoach
186
10k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
RailsConf 2023
tenderlove
29
910
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
It's Worth the Effort
3n
183
27k
Visualization
eitanlees
145
15k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
Faster Mobile Websites
deanohume
305
30k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
440
Transcript
THE SCIENCE OF ETHERPAD MAKING ANY DOCUMENT COLLABORATIVE, ANYWHERE
Operations
app
apple
“app” + ”le”
app Operation 1 1. insertCharacter “a” 2. insertCharacter “p” 3.
insertCharacter “p“
apple Operation 2 1. retain (skip character) 2. retain (skip
character) 3. retain (skip character) 4. insertCharacter “l” 5. insertCharacter “e“
applecore Operation 2 1. retain (skip character) 2. retain (skip
character) 3. retain (skip character) 4. retain (skip character) 5. retain (skip character) 6. insertCharacter “c” 7. insertCharacter “o“ 8. insertCharacter “r“ 9. insertCharacter “e“
Composition
appl Operation 1 1. retain (skip character) 2. retain (skip
character) 3. retain (skip character) 4. insertCharacter “l” apple Operation 2 1. retain (skip character) 2. retain (skip character) 3. retain (skip character) 4. retain (skip character) 5. insertCharacter “e”
Operation 1+2 1. retain (skip character) 2. retain (skip character)
3. retain (skip character) 4. insertCharacter “l” 5. insertCharacter “e“ appl apple
Concurrency
app app CLIENT A CLIENT B
appl appe CLIENT A CLIENT B
appl Operation A 1. retain (skip character) 2. retain (skip
character) 3. retain (skip character) 4. insertCharacter “l” appe Operation B 1. retain (skip character) 2. retain (skip character) 3. retain (skip character) 4. insertCharacter “e” CLIENT A CLIENT B
appl Operation B 1. retain (skip character) 2. retain (skip
character) 3. retain (skip character) 4. insertCharacter “e” appe Operation A 1. retain (skip character) 2. retain (skip character) 3. retain (skip character) 4. insertCharacter “l” CLIENT A CLIENT B
appel Operation B 1. retain (skip character) 2. retain (skip
character) 3. retain (skip character) 4. insertCharacter “e” apple Operation A 1. retain (skip character) 2. retain (skip character) 3. retain (skip character) 4. insertCharacter “l” CLIENT A CLIENT B
appel apple CLIENT A CLIENT B
Operational Transform
“A theoretical framework of concurrency control” that “provides a mechanism
for sanely resolving [editing] conflicts so that neither user intervention or locking become necessary.” A mechanism to “transform” two operations in conflict, resulting in two new operations which bring both clients into a common state.
app app CLIENT A CLIENT B SERVER
appl Operation A 1. retain (skip character) 2. retain (skip
character) 3. retain (skip character) 4. insertCharacter “l” CLIENT A SERVER 1 appe Operation B 1. retain (skip character) 2. retain (skip character) 3. retain (skip character) 4. insertCharacter “e” CLIENT B 2
Operation A 1. retain (skip character) 2. retain (skip character)
3. retain (skip character) 4. insertCharacter “l” SERVER TRANSFORM Operation B 1. retain (skip character) 2. retain (skip character) 3. retain (skip character) 4. insertCharacter “e” Operation B` 1. retain (skip character) 2. retain (skip character) 3. retain (skip character) 4. retain (skip character) 5. insertCharacter “e” Operation A` 1. retain (skip character) 2. retain (skip character) 3. retain (skip character) 4. insertCharacter “l” 5. retain (skip character)
appl Operation B` 1. retain (skip character) 2. retain (skip
character) 3. retain (skip character) 4. retain (skip character) 5. insertCharacter “e” CLIENT A SERVER appe Operation A` 1. retain (skip character) 2. retain (skip character) 3. retain (skip character) 4. insertCharacter “l” 5. retain (skip character) CLIENT B B` A`
apple Operation B` 1. retain (skip character) 2. retain (skip
character) 3. retain (skip character) 4. retain (skip character) 5. insertCharacter “e” CLIENT A SERVER apple Operation A` 1. retain (skip character) 2. retain (skip character) 3. retain (skip character) 4. insertCharacter “l” 5. retain (skip character) CLIENT B B` A`
apple apple CLIENT A CLIENT B
CLIENT A CLIENT B A1: retain 3, insert “l” Broadcast
A1 Apply A1` SERVER
CLIENT A CLIENT B SERVER A1: retain 3, insert “l”
B1: retain 3, insert “e” Transform A1 x B1 Apply A1` Apply B1`
CLIENT A CLIENT B SERVER A1: retain 3, insert “l”
B1: retain 3, insert “e” A2: retain 4, insert “core” Transform A1 x B1 Apply A1` Transform A2 x B1` Apply B1`` Broadcast A2 Apply A2`
CLIENT A CLIENT B SERVER A1: retain 3, insert “l”
B1: retain 3, insert “e” A2: retain 4, insert “core” Transform A1 x B1 B2: retain 4, insert “sauce” Transform B2 x A1` Apply A1`` Transform A2 x B1` Apply B1`` Transform A2` x B2` Apply A2`` Apply B2``
CLIENT A CLIENT B SERVER A1: retain 3, insert “l”
B1: retain 3, insert “e” A2: retain 4, insert “core” Transform A1 x B1 B2: retain 4, insert “sauce” Transform B2 x A1` Apply A1`` Transform A2 x B1` Apply B1`` Transform A2` x B2` Apply A2`` Apply B2``
Markup
big apple
big apple
<i>big</i> <b>apple</b>
<i>big</i> <b>apple</b>
<i>big</i> <b>apple</b> Operation 1. insertStartTag “i” 2. insertCharacter “b” 3.
insertCharacter “i” 4. insertCharacter “g” 5. insertEndTag “i” 6. insertCharacter “ ” 7. insertStartTag “b” 8. insertCharacter “a” 9. insertCharacter “p” 10. insertCharacter “p” 11. insertCharacter “l” 12. insertCharacter “e” 13. insertEndTag “b”
a big word a big word CLIENT A CLIENT B
a <b>big</b> word Operation A 1. retain 2 2. insertStartTag
“b” 3. retain 3 4. insertEndTag “b” a biiiiig word Operation B 1. retain 3 2. insertCharacters “iiii” CLIENT A CLIENT B
a <b>big</b> word Operation B` 1. retain 4 2. insertCharacters
“iiii” a biiiiig word Operation A` 1. retain 2 2. insertStartTag “b” 3. retain 5 4. insertEndTag “b” CLIENT A CLIENT B
a <b>biiiiig</b> word Operation B` 1. retain 4 2. insertCharacters
“iiii” a <b>biiiiig</b> word Operation A` 1. retain 2 2. insertStartTag “b” 3. retain 5 4. insertEndTag “b” CLIENT A CLIENT B
Preserving Intent
CLIENT A CLIENT B Desired Word1 Word2 Word3 <ol> <li>
Word4 Word5 Word6 </li> </ol> <ol> <li> Word1 Word2 Word3 Word4 </li> </ol> Word5 Word6 <ol> <li> Word1 Word2 Word3 Word4 Word5 Word6 </li> </ol>
CLIENT A CLIENT B Desired Word1 Word2 <p> Word3 Word4
Word5 Word6 </p> <h1> Word1 Word2 Word3 Word4 </h1> Word5 Word6 <h1> Word1 Word2 </h1> <p> Word3 Word4 </p> <p> Word5 Word6 </p>
CLIENT A CLIENT B Desired Word1 Word2 Word3 <i> Word4
Word5 Word6 Word7 Word8 </i> <b> Word1 Word2 Word3 Word4 Word5 </b> Word6 Word7 Word8 <b> Word1 Word2 Word3 </b> <bi> Word4 Word5 </bi> <i> Word6 Word7 Word8 </i>
• retain • deleteCharacter • deleteStartTag(tag, attrs) • deleteEndTag() •
deleteEmptyTag() • insertCharacter • insertStartTag(tag, attrs) • insertEndTag() • insertEmptyTag() • modifyAttrs(attrs) Deletion Phase Insertion Phase OPERATION ATOMS
Containers like: preserve unlike: priority Blocks like: priority unlike: priority
Styles like: preserve unlike: merge Inline <ul> <li> <ol> <blockquote> <p> <div> <h1> <h2> <h3> <pre> <b> <i> <span> <u> <s> “text” <br> DOCUMENT SCHEMA