Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Synchronizing HTML5 databases using XQuery

Synchronizing HTML5 databases using XQuery

HTML5 has shifted the original model of the web from a thin client
architecture to a thick client architecture.
In such setup, the browser runs a full-fledged application with a
client database, namely IndexedDB, that synchronises with the Cloud.
This new generation of application puts a tremendous amount of
pressure on two aspects of the HTML5 database: complex query
processing of the client data and synchronisation with the Cloud.
We think that XQuery can help.
The goal of this presentation is to showcase how XQuery can be used in
the context of HTML5 applications.
First, XQuery is a powerful query language to process the
semi-structured data that lives in the browser.
Moreover, declarative updates from XQuery can be used to efficiently
synchronise an HTML5 databases with the Cloud.
We will introduce a master-to-master replication protocol between
IndexedDB and MongoDB entirely based on the composition of
pending update lists.
We will demonstrate the protocol in action and detail the various
interaction between HTML5 and XQuery in this context.

William Candillon

October 25, 2013
Tweet

More Decks by William Candillon

Other Decks in Programming

Transcript

  1. “Speed is the second biggest engagement driver on the Internet.

    Just after perceived speed” Alex MacCaw
  2. Normalization normalize( insert { title: "Eat" } into $todo, insert

    { done: false } into $todo
 ) -> insert { title: "Eat", done: false } into $todo
  3. Composition compose( insert { title: "Eat" } into $todos, replace

    value of $todos[$$.title eq "Eat"].title with "Buy Food"
 ) -> insert { title: "Buy Food" } into $todos
  4. Synchronization Server v2 v3 v2 Client 1 update(v2  ,  Δc)

    ACK Δc v3 v2 Client 2 v3 update(v2  ,  Δc,  v3)
  5. Synchronization Server v2 v3 v2 Client 1 update(v2  ,  Δc)

    Δc ? Merge Policies Conflict detection! and reconciliation operators
  6. •Goal: Compile Zorba to JS •Tool: Emscriptem •LLVM bitcode-to-JS compiler

    •Emits ASM code 
 An optimizable, low-level subset of JavaScript Zorba.js (1/2)