Couchbase_for mobile_Couchbase_SF_2013

30

Transcript of Couchbase_for mobile_Couchbase_SF_2013

Page 1: Couchbase_for mobile_Couchbase_SF_2013
Page 2: Couchbase_for mobile_Couchbase_SF_2013

Couchbase  for  Mobile  

Dip2  Borkar  –  Director,  Product  Management  

J.  Chris  Anderson  –  Mobile  Architect  

Page 3: Couchbase_for mobile_Couchbase_SF_2013

Couchbase  Lite  

The  only  Na2ve  NoSQL  Database  for  

Mobile  

Page 4: Couchbase_for mobile_Couchbase_SF_2013

The  Complete  Mobile  Solu2on  

Page 5: Couchbase_for mobile_Couchbase_SF_2013

JSON  Anywhere    

Couchbase  Server  

•  JSON  on  the  device  ­  Developers  

increasingly  prefer  NoSQL  database  

•  JSON  on  the  wire  ­  No  need  for  data  

transforma<on  

•  JSON  in  the  cloud  ­  Flexible  data  model  ­  High  performance  ­  Easy  scalability  

ServerSync GatewayLiteJS N

JS N

JS N

Page 6: Couchbase_for mobile_Couchbase_SF_2013

Architecture  

   

SERVER  3      

SERVER  1      

SERVER  2  

Couchbase  Server  

   

Channel

Sync  Gateway  

Channel

   

Channel

Sync  Gateway  

Channel

Couchbase  Lite  for  iOS  and  Android  

On Premise In the cloud

Page 7: Couchbase_for mobile_Couchbase_SF_2013

Couchbase  Lite  The  only  NoSQL  Database  for  Mobile  Devices  

•  Features  ­  Ultra-­‐lightweight,  secure  JSON  database    

­  Na<ve  support  for  iOS,  Android  and  REST/HTML5  

­  Full  document,  index  and  querying  and  sync  capabili<es  

­  Powerful  conflict  resolu<on  Lite

Couchbase  Lite    

Android  

Couchbase  Lite    iOS  

Page 8: Couchbase_for mobile_Couchbase_SF_2013

What  you  get  

Lite

Couchbase  Lite    

Android  

Couchbase  Lite    iOS  

­  Enable  new  class  of  rich  data  intensive  local  applica<ons    

­  Rapid  development  using  na<ve  JSON  data  

­  Highly  responsive  interac<ve  applica<ons  

­  Always  available  -­‐    online  or  offline  

Page 9: Couchbase_for mobile_Couchbase_SF_2013

What  you  get  

         JSON  Everywhere    

•  Flexible  JSON  on  device  lets  you  work  with  local  data  &  modify  your  data  structure  on  the  fly  without  impac<ng  your  back-­‐end.  

•  Your  users  can  count  on  having  an  amazing  app  experience  with  a  fast  and  unbreakable  local  database      

Easy  Sync  

•  Effortlessly  sync  local  data  with  a  database  in  the  cloud  for  updates,  replica<on  or  collabora<ve  sharing.  

•  In  addi<on,  scale  your  data  <er  horizontally  and  reliably  as  your  data  and  sync  needs  grow.    

JSONJSONJSON

JSONJSON

Page 10: Couchbase_for mobile_Couchbase_SF_2013

Couchbase  Sync  Gateway  Easy,  Reliable  Data  Sync  to  the  Cloud  

•  Features  •  Dynamic  sync  capabili<es  via  

Sync  Func<on  APIs  •  Easy  Administra<on  •  Seamless  scaleout  

•  Benefits  ­  10x  reduc<on  in  development  

<me  ­  Scales  to  support  millions  of  

users  

Sync Gateway

Page 11: Couchbase_for mobile_Couchbase_SF_2013

How  does  sync  work?  

Page 12: Couchbase_for mobile_Couchbase_SF_2013

Collaborate  using  Channels  

•  For  each  document,  you  specify  a  set  of  channels  it  belongs  to  

•  For  each  user  or  device,  you  control  which  channels  they  can  access  

•  Replicate  only  a  subset  of  documents  down  to  the  device  ­  User-­‐defined  filter  func<ons    ­  Simply  lets  you  know  whether  a  document  should  be  replicated  

•  And  you  can  authen2cate  users    

 

Page 13: Couchbase_for mobile_Couchbase_SF_2013

Data Routing

Dat

a D

ata

Page 14: Couchbase_for mobile_Couchbase_SF_2013

Data Routing

Dat

a

Data

Dat

a

Page 15: Couchbase_for mobile_Couchbase_SF_2013

Data Routing

Data

Dat

a D

ata

Page 16: Couchbase_for mobile_Couchbase_SF_2013

Data Routing

Dat

a Da

ta

Page 17: Couchbase_for mobile_Couchbase_SF_2013

Data Routing

Data

Data

Dat

a D

ata

Page 18: Couchbase_for mobile_Couchbase_SF_2013

Data Routing

Data

Dat

a D

ata

Page 19: Couchbase_for mobile_Couchbase_SF_2013

How  do  I  get  started?  

Zero to sync in 5 minutes !!!

Page 20: Couchbase_for mobile_Couchbase_SF_2013

A  liVle  deep  dive  

•  Get  familiar  with  Couchbase  Lite  through  looking  at  an  applica2on  

•  Introduce  the  app  with  a  demo  ­  create  a  list  /  live  query  my  lists  ­  create  some  tasks  /  live  query  tasks  ­  sign  in  to  the  cloud  ­  collaborate  via  the  cloud  

•  Show  the  code  for  the  features  as  we  use  them  

Page 21: Couchbase_for mobile_Couchbase_SF_2013

Couchbase  Lite  -­‐  Features  

 JSON  /  REST  interface    -­‐  CRUD  opera<ons  use  

HTTP  verbs  

-­‐  Works  with  libraries  like  jQuery  and  Backbone  Live  Query  UI  Updates  

 -­‐  UI  updated  to  reflect  

database  changes,  even  for  remote  changes  

-­‐  HTTP  long  poll  API  to  support  quick  redraw  

Collaborate  via  Cloud  -­‐  social  network  login  

-­‐  programmable  sync  func<on  for  update  valida<on  and  channel  rou<ng  

Page 22: Couchbase_for mobile_Couchbase_SF_2013

JSON  Document  Schema  

Page 23: Couchbase_for mobile_Couchbase_SF_2013

All  Todo  Lists  

•  Rendered  with  HTML  and  JavaScript  

•  View  query  to  show  all  the  lists  on  a  device.  

•  Form  submit  event  creates  a  document  represen2ng  a  list.  

Page 24: Couchbase_for mobile_Couchbase_SF_2013

Task  List  -­‐  Items  

•  Toggle  a  checkbox  •  Add  a  photo  •  Live  update  

Page 25: Couchbase_for mobile_Couchbase_SF_2013

Toggle  a  Task  Checkbox  by  upda2ng  the  JSON  Document  

Uses  a  familiar  REST  paradigm.  GET  and  PUT  used  here.  

Page 26: Couchbase_for mobile_Couchbase_SF_2013

Live  Update  UI  

Local  and  remote  updates  both  trigger  a  database  event,  used  for  redraw.  

Page 27: Couchbase_for mobile_Couchbase_SF_2013

Sign-­‐in  to  sync  and  collaborate  

•  Example  uses  Facebook,  we  support  a  wide  variety  of  authen2ca2on  op2on  

•  Pick  from  the  list  of  signed  in  users  when  sharing  

Page 28: Couchbase_for mobile_Couchbase_SF_2013

Photo  AVachment  

Page 29: Couchbase_for mobile_Couchbase_SF_2013

Sync  Func2on  

•  Applica2on  code  run  in  the  cloud  

•  Access  control  •  Channel  rou2ng  •  Update  Valida2on  

Your  cloud  in  one  page  of  code.  

Page 30: Couchbase_for mobile_Couchbase_SF_2013

Get  Started  

mobile.couchbase.com  

Sample  App  

•  hVps://github.com/couchbaselabs/TodoLite-­‐PhoneGap