Pro Yearly is on sale from $80 to $50! »

Woot for Lift

Woot for Lift

Presentation at Scala eXchange, London, 3 December 2013.
With @jonoabroad

Ff619670d30ebdeefd49cf10af8e3292?s=128

Richard Dallaway

December 03, 2013
Tweet

Transcript

  1. \o/ WOOT  for Lift Richard Dallaway @d6y Jono Ferguson

    @jonoabroad
  2. Richard Dallaway @d6y

  3. Collaborative Editing

  4. Don’t Do This A B C A B C Site

    A Site B 1 2 3 1 2 3
  5. Don’t Do This A B C A B C Site

    A Site B 1 2 3 1 2 3 A x B C 1 2 3 4 insert x @ 2
  6. Don’t Do This A B C A B C Site

    A Site B 1 2 3 1 2 3 A x B C 1 2 3 4 insert x @ 2 A B 1 2 delete 3
  7. Don’t Do This A B C A B C Site

    A Site B 1 2 3 1 2 3 A x B C 1 2 3 4 insert x @ 2 A B 1 2 delete 3 A x B
  8. Don’t Do This A B C A B C Site

    A Site B 1 2 3 1 2 3 A x B C 1 2 3 4 insert x @ 2 A B 1 2 delete 3 A x B A x C
  9. What do we want? ‣Intention Preservation ‣Causal Consistency ‣Convergence When

    do we want it? Eventually
  10. The WOOT Algorithm

  11. WOOT A B C A B C Site A Site

    B 1 2 3 1 2 3
  12. WOOT A B C A B C Site A Site

    B 1 2 3 1 2 3 1 2 3 4 A x B C A ≺ x ≺ B
  13. WOOT A B C A B C Site A Site

    B 1 2 3 1 2 3 1 2 3 4 A x B C A ≺ x ≺ B 1 2 A B delete C
  14. WOOT A B C A B C Site A Site

    B 1 2 3 1 2 3 1 2 3 4 A x B C A ≺ x ≺ B 1 2 A B delete C A x B
  15. WOOT A B C A B C Site A Site

    B 1 2 3 1 2 3 1 2 3 4 A x B C A ≺ x ≺ B 1 2 A B delete C A x B A x B
  16. WChar ID Prev Next Alpha Visible?

  17. WChar ID Prev Next Alpha Visible? Site Clock

  18. WChar ID Prev Next Alpha Visible? Site Clock ID ID

  19. WOOT Algorithm Local Integration Remote Integration

  20. WOOT Algorithm (WString, Char, Pos) => 
 (WString, WChar) Local

    Integration Remote Integration
  21. WOOT Algorithm (WString, Char, Pos) => 
 (WString, WChar) Local

    Integration (WString, WChar) => WString Remote Integration
  22. WOOT Algorithm a b c d a b c d

    a b c d a b c x d a c d a b y c d
  23. WOOT Algorithm a b c d a b c d

    a b c d a b c x d a c d a b y c d a b c d
  24. WOOT Algorithm a b c d a b c d

    a b c d a b c x d a c d a b y c d a b c d x
  25. WOOT Algorithm a b c d a b c d

    a b c d a b c x d a c d a b y c d a b c d x /
  26. WOOT Algorithm a b c d a b c d

    a b c d a b c x d a c d a b y c d a b c d x y /
  27. Example using Ace

  28. Scala, JavaScript, Lift WOOT Local WOOT Model

  29. Scala, JavaScript, Lift WOOT x Local WOOT Model

  30. Scala, JavaScript, Lift WOOT x Local WOOT Model A ≺

    x ≺ B
  31. Scala, JavaScript, Lift WOOT WOOT WOOT x Local WOOT Model

    A ≺ x ≺ B
  32. Scala, JavaScript, Lift WOOT WOOT WOOT x Local WOOT Model

    A ≺ x ≺ B
  33. Scala, JavaScript, Lift WOOT WOOT WOOT x x x Local

    WOOT Model A ≺ x ≺ B
  34. Fork It bitbucket.org/d6y/woot

  35. Fork It bitbucket.org/d6y/woot $ git clone https://d6y@bitbucket.org/d6y/woot.git $ ./sbt >

    container:start
  36. Fork It bitbucket.org/d6y/woot $ git clone https://d6y@bitbucket.org/d6y/woot.git $ ./sbt >

    container:start
  37. JavaScript jQuery(document).ready(function() { wootServer.init({doc:1}).then(messageHandler); });

  38. JavaScript jQuery(document).ready(function() { wootServer.init({doc:1}).then(messageHandler); }); <script data-lift="WootServices"> var wootServer =

    { init: function(config) { return $.Deferred().promise(); }, send: function(wchar) {} }; </script>
  39. JavaScript jQuery(document).ready(function() { wootServer.init({doc:1}).then(messageHandler); }); <script data-lift="WootServices"> var wootServer =

    { init: function(config) { return $.Deferred().promise(); }, send: function(wchar) {} }; </script>
  40. Scala def services = List[RoundTripInfo]( "send" -> receive _, "init"

    -> init _)
  41. Scala def services = List[RoundTripInfo]( "send" -> receive _, "init"

    -> init _) def init(config: JValue) : Stream[JValue] = { ! 
 ! }
  42. Scala def services = List[RoundTripInfo]( "send" -> receive _, "init"

    -> init _) def init(config: JValue) : Stream[JValue] = { ! 
 ! } val doc = toJson(wootModel) val q = LinkedBlockingQueue[JValue]() doc #:: Stream.continually(q.take())
  43. Pros ‣No vector clocks ‣Simple
 LoC Scala JavaScript Model 100

    200 Glue 100 100
  44. Cons ‣Bulk operations ‣Space
 ‣No GC


  45. You Have Options OT Many options (since 1998) •Wave •Google

    Docs •Etherpad Post-OT Tombstones Tombstones WOOT 2005 RGA 2011 CT 2010 Treedoc 2007 Logoot 2009 LSEQ 2013 ×
  46. References Oster et al (2006) Data Consistency for P2P Collaborative

    Editing http://www.loria.fr/~oster/pmwiki/pub/papers/OsterCSCW06.pdf Ahmed-Nacer et al (2011) Evaluating CRDTs for Real-time Document Editing http://hal.archives-ouvertes.fr/docs/00/62/95/03/PDF/doce63-ahmednacer.pdf Nédelec, Molli, Mostefaoui & Desmontils (2013)
 LSEQ: an Adaptive Structure for Sequences in Distributed Collaborative Editing http://dl.acm.org/citation.cfm?id=2494278
  47. Summary ‣WOOT pretty neat ‣Lift is pretty neat ‣Put effort

    into the editor
 ‣Fun area, go explore

  48. Thank  you Richard Dallaway Jono Ferguson @d6y @jonoabroad bitbucket.org/d6y/woot