Transcript
Page 1: Webinar - Couchbase Lite Under the Hood

Couchbase*Lite*Under*the*Hood*

J.*Chris*Anderson*–*Mobile*Architect*

Page 2: Webinar - Couchbase Lite Under the Hood

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 3: Webinar - Couchbase Lite Under the Hood

Couchbase*Lite*The*only*NoSQL*Database*for*Mobile*Devices*

•  Features*­  UltraBlightweight,*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 4: Webinar - Couchbase Lite Under the Hood

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 5: Webinar - Couchbase Lite Under the Hood

Couchbase*Server*IndustryKleading*NoSQL*database*

•  MulMple*deployment*opMons*

­  OnBPremise*­  Hosted*on*Amazon*­  Cloud*Services*

• Couchbase*Cloud*• KuroBase*

Server

Page 6: Webinar - Couchbase Lite Under the Hood

IntegraMons*Partnerships*for*Couchbase*Lite*

hVps://marketplace.appcelerator.com/apps/6706?1396013098*

hVp://components.xamarin.com/view/couchbaseBlite/*

hVp://plugins.cordova.io/#/com.couchbase.lite.phonegap*

Couchbase*Lite*Plugin*for*PhoneGap*

Couchbase*Lite*for*Xamarin*

Couchbase*Lite*Titanium*

Page 7: Webinar - Couchbase Lite Under the Hood

Sync%Architecture

Page 8: Webinar - Couchbase Lite Under the Hood

Server%3Server%1 Server%2

Couchbase%Server

Page 9: Webinar - Couchbase Lite Under the Hood

Architecture

Server%3Server%1 Server%2

Couchbase%Server

On Premise In the cloud

Page 10: Webinar - Couchbase Lite Under the Hood

Architecture

Server%3Server%1 Server%2

Couchbase%Server

Channel

Sync%Gateway

Channel Channel

Sync%Gateway

Channel

On Premise In the cloud

Page 11: Webinar - Couchbase Lite Under the Hood

Architecture

Server%3Server%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 12: Webinar - Couchbase Lite Under the Hood

!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 13: Webinar - Couchbase Lite Under the Hood

Demo%>%Todo%List%App

!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 14: Webinar - Couchbase Lite Under the Hood
Page 15: Webinar - Couchbase Lite Under the Hood

A%Day%in%the%Life%of%a%Document

Page 16: Webinar - Couchbase Lite Under the Hood

Data%Flow

Server%3Server%1 Server%2

Couchbase%Server

Channel

Sync%Gateway

Channel Channel

Sync%Gateway

Channel

Couchbase%Lite%for%iOS%and%Android

Sync%Push

Page 17: Webinar - Couchbase Lite Under the Hood

Data%Flow

Server%3Server%1 Server%2

Couchbase%Server

Channel

Sync%Gateway

Channel Channel

Sync%Gateway

Channel

Couchbase%Lite%for%iOS%and%Android

JavaScript%Sync%FuncEon�

Page 18: Webinar - Couchbase Lite Under the Hood

Data%Flow

Server%3Server%1 Server%2

Couchbase%Server

Channel

Sync%Gateway

Channel Channel

Sync%Gateway

Channel

Couchbase%Lite%for%iOS%and%Android

Store%Data

Page 19: Webinar - Couchbase Lite Under the Hood

Data%Flow

Server%3Server%1 Server%2

Couchbase%Server

Channel

Sync%Gateway

Channel Channel

Sync%Gateway

Channel

Couchbase%Lite%for%iOS%and%Android

TAP/UPR

Page 20: Webinar - Couchbase Lite Under the Hood

Data%Flow

Server%3Server%1 Server%2

Couchbase%Server

Channel

Sync%Gateway

Channel Channel

Sync%Gateway

Channel

Couchbase%Lite%for%iOS%and%Android

HTTP%Changes

Page 21: Webinar - Couchbase Lite Under the Hood
Page 22: Webinar - Couchbase Lite Under the Hood

Embedded%Database

Page 23: Webinar - Couchbase Lite Under the Hood

Couchbase%Lite%Components

KeyAValueJSON!

Storage

Sync!Engine

Map/ReduceView!Indexer

Query!Engine

ApplicaHon!API

Page 24: Webinar - Couchbase Lite Under the Hood

Couchbase%Lite%Components

KeyAValueJSON!

Storage

Sync!Engine

Map/ReduceView!Indexer

Query!Engine

ApplicaHon!API

Page 25: Webinar - Couchbase Lite Under the Hood

Couchbase%Lite%Components

KeyAValueJSON!

Storage

Sync!Engine

Map/ReduceView!Indexer

Query!Engine

ApplicaHon!API

Page 26: Webinar - Couchbase Lite Under the Hood

Couchbase%Lite%Components

KeyAValueJSON!

Storage

Sync!Engine

Map/ReduceView!Indexer

Query!Engine

ApplicaHon!API

Page 27: Webinar - Couchbase Lite Under the Hood

Couchbase%Lite%Components

KeyAValueJSON!

Storage

Sync!Engine

Map/ReduceView!Indexer

Query!Engine

ApplicaHon!API

Page 28: Webinar - Couchbase Lite Under the Hood

Couchbase%Lite%Components

KeyAValueJSON!

Storage

Sync!Engine

Map/ReduceView!Indexer

Query!Engine

ApplicaHon!API

Page 29: Webinar - Couchbase Lite Under the Hood

Live%QueryObjecEve>C%code%example

Page 30: Webinar - Couchbase Lite Under the Hood

Mobile%ApplicaEon%Process

Storage

Couchbase!Lite

NaHve!ApplicaHon!Logic

Sync

Page 31: Webinar - Couchbase Lite Under the Hood

PhoneGap%Plugin

Storage

Couchbase!Lite

SyncREST!Connector

Web!RunHme

PhoneGap!Plugins

Camera,!etcJavaScript

ApplicaHon!Logic

XHR!Ajax

getURL(function(err,0url){console.log(url)

})

Page 32: Webinar - Couchbase Lite Under the Hood

Toggle&a&Task&Checkbox&by&upda3ng&the&JSON&Document

Page 33: Webinar - Couchbase Lite Under the Hood

REST%to%GET%and%PUT%documents

Toggle&a&Task&Checkbox&by&upda3ng&the&JSON&Document

Page 34: Webinar - Couchbase Lite Under the Hood
Page 35: Webinar - Couchbase Lite Under the Hood

SelecEve%Sync

Page 36: Webinar - Couchbase Lite Under the Hood

SelecEve%Sync

Server%3Server%1 Server%2

Couchbase%Server

Channel

Sync%Gateway

Channel Channel

Sync%Gateway

Channel

Couchbase%Lite%for%iOS%and%Android

Sync%Push

Page 37: Webinar - Couchbase Lite Under the Hood

Server%3Server%1 Server%2

Couchbase%Server

Channel

Sync%Gateway

Channel Channel

Sync%Gateway

Channel

Couchbase%Lite%for%iOS%and%Android

JavaScript%Sync%FuncEon�

SelecEve%Sync

Page 38: Webinar - Couchbase Lite Under the Hood

Server%3Server%1 Server%2

Couchbase%Server

Channel

Sync%Gateway

Channel Channel

Sync%Gateway

Channel

Couchbase%Lite%for%iOS%and%Android

Store%Data

SelecEve%Sync

Page 39: Webinar - Couchbase Lite Under the Hood

Server%3Server%1 Server%2

Couchbase%Server

Channel

Sync%Gateway

Channel Channel

Sync%Gateway

Channel

Couchbase%Lite%for%iOS%and%Android

TAP/UPR

SelecEve%Sync

Page 40: Webinar - Couchbase Lite Under the Hood

Server%3Server%1 Server%2

Couchbase%Server

Channel

Sync%Gateway

Channel Channel

Sync%Gateway

Channel

Couchbase%Lite%for%iOS%and%Android

HTTP%Changes

SelecEve%Sync

Page 41: Webinar - Couchbase Lite Under the Hood

Doc%1 Channel%A

Page 42: Webinar - Couchbase Lite Under the Hood

Doc%1 Channel%A

Doc%2Channel%A

Channel%B

Channel%A%&%B

Channel%B

Page 43: Webinar - Couchbase Lite Under the Hood

Doc%1 Channel%A

Doc%2Channel%A

Channel%B

Channel%A%&%B

Channel%B

Page 44: Webinar - Couchbase Lite Under the Hood

Doc%1 Channel%A

Doc%2Channel%A

Channel%B

Channel%A%&%B

Channel%B

Doc%1Doc%2

Page 45: Webinar - Couchbase Lite Under the Hood

Doc%1 Channel%A

Doc%2Channel%A

Channel%B

Channel%A%&%B

Channel%B

Doc%1Doc%2

Page 46: Webinar - Couchbase Lite Under the Hood

Doc%1 Channel%A

Doc%2Channel%A

Channel%B

Channel%A%&%B

Channel%B

Doc%1Doc%2

Doc%2

Page 47: Webinar - Couchbase Lite Under the Hood

Data Routing

Dat

aD

ata

Page 48: Webinar - Couchbase Lite Under the Hood

Data Routing

Dat

a

Data

Dat

a

Page 49: Webinar - Couchbase Lite Under the Hood

Data Routing

Data

Data

Dat

aD

ata

Page 50: Webinar - Couchbase Lite Under the Hood

Data RoutingDa

ta

Data

Data

Dat

aD

ata

Page 51: Webinar - Couchbase Lite Under the Hood

Data RoutingDa

ta

Data

Data Data

Dat

aD

ata

Page 52: Webinar - Couchbase Lite Under the Hood

Data RoutingDa

ta

Data

DataData

Dat

aD

ata

Page 53: Webinar - Couchbase Lite Under the Hood
Page 54: Webinar - Couchbase Lite Under the Hood

Sync%Gateway

Page 55: Webinar - Couchbase Lite Under the Hood

Architecture

Server%3Server%1 Server%2

Couchbase%Server

Channel

Sync%Gateway

Channel Channel

Sync%Gateway

Channel

Couchbase%Lite%for%iOS%and%Android

Page 56: Webinar - Couchbase Lite Under the Hood

Sync%Gateway:%App%Logic%&%Storage

Couchbase!Smart!Client

Revision/Conflict!

Management

App’s!Sync!FuncHon

to'Couchbase'Server

AuthenHcaHon

Page 57: Webinar - Couchbase Lite Under the Hood

Sync%Gateway:%App%Logic%&%Storage

Couchbase!Smart!Client

Revision/Conflict!

Management

App’s!Sync!FuncHon

to'Couchbase'Server

function(doc,0oldDoc)0{…requireUser(oldDoc.owner);…channel(doc.channel);…access(doc.members,0doc.roomID);

}

AuthenHcaHon

Page 58: Webinar - Couchbase Lite Under the Hood

Sync%Gateway:%App%Logic%&%Storage

Couchbase!Smart!Client

Revision/Conflict!

Management

App’s!Sync!FuncHon

to'Couchbase'Server

function(doc,0oldDoc)0{…requireUser(oldDoc.owner);…channel(doc.channel);…access(doc.members,0doc.roomID);

}

validaHon

AuthenHcaHon

Page 59: Webinar - Couchbase Lite Under the Hood

Sync%Gateway:%App%Logic%&%Storage

Couchbase!Smart!Client

Revision/Conflict!

Management

App’s!Sync!FuncHon

to'Couchbase'Server

function(doc,0oldDoc)0{…requireUser(oldDoc.owner);…channel(doc.channel);…access(doc.members,0doc.roomID);

}

rouHng

AuthenHcaHon

Page 60: Webinar - Couchbase Lite Under the Hood

Sync%Gateway:%App%Logic%&%Storage

Couchbase!Smart!Client

Revision/Conflict!

Management

App’s!Sync!FuncHon

to'Couchbase'Server

function(doc,0oldDoc)0{…requireUser(oldDoc.owner);…channel(doc.channel);…access(doc.members,0doc.roomID);

}

access!ctrl

AuthenHcaHon

Page 61: Webinar - Couchbase Lite Under the Hood

Sync%Gateway:%App%Logic%&%Storage

Couchbase!Smart!Client

Revision/Conflict!

Management

App’s!Sync!FuncHon

to'Couchbase'Server

AuthenHcaHon

Page 62: Webinar - Couchbase Lite Under the Hood

Sync%Gateway:%App%Logic%&%Storage

Couchbase!Smart!Client

Revision/Conflict!

Management

App’s!Sync!FuncHon

to'Couchbase'Server

rev 1 rev 2

rev 3a

rev 3b

AuthenHcaHon

Page 63: Webinar - Couchbase Lite Under the Hood

Sync%Gateway:%App%Logic%&%Storage

Couchbase!Smart!Client

Revision/Conflict!

Management

App’s!Sync!FuncHon

to'Couchbase'Server

AuthenHcaHon

Page 64: Webinar - Couchbase Lite Under the Hood

Programmable Sync

Page 65: Webinar - Couchbase Lite Under the Hood

Your%Cloud%in%One%Page%of%Code

• ApplicaEon%logic%run%by%the%Gateway­ Access%Control­ Channel%Rou0ng­ Update%Valida0on

Programmable Sync

Page 66: Webinar - Couchbase Lite Under the Hood

Sync%Gateway%Components

SyncREST!API

Couchbase!Smart!Client

Revision/Conflict!

Management

AuthenHcaHon

App’s!Sync!FuncHon

Channel!Change!Tracking

External!Auth!Services

to'client

to'Couchbase'Server

Page 67: Webinar - Couchbase Lite Under the Hood

Custom%User%AuthenEcaEon

Sync!Gateway

Session!Key!Generator

Custom!App!Server

Couchbase!Lite

LDAP,!etc.

Auth Auth

Back

Page 68: Webinar - Couchbase Lite Under the Hood

Custom%User%AuthenEcaEon

Sync!Gateway

Session!Key!Generator

Custom!App!Server

Couchbase!Lite

LDAP,!etc.

Auth Auth

Back

Page 69: Webinar - Couchbase Lite Under the Hood

Custom%User%AuthenEcaEon

Sync!Gateway

Session!Key!Generator

Custom!App!Server

Couchbase!Lite

LDAP,!etc.

Auth Auth

Back

Page 70: Webinar - Couchbase Lite Under the Hood

Custom%User%AuthenEcaEon

Sync!Gateway

Session!Key!Generator

Custom!App!Server

Couchbase!Lite

LDAP,!etc.

Auth Auth

Back

Page 71: Webinar - Couchbase Lite Under the Hood

Custom%User%AuthenEcaEon

Sync!Gateway

Session!Key!Generator

Custom!App!Server

Couchbase!Lite

LDAP,!etc.

Auth Auth

Back

Page 72: Webinar - Couchbase Lite Under the Hood

Custom%User%AuthenEcaEon

Sync!Gateway

Session!Key!Generator

Custom!App!Server

Couchbase!Lite

LDAP,!etc.

Auth Auth

Back

Page 73: Webinar - Couchbase Lite Under the Hood

Custom%User%AuthenEcaEon

Sync!Gateway

Session!Key!Generator

Custom!App!Server

Couchbase!Lite

LDAP,!etc.

Auth Auth

Back

Page 74: Webinar - Couchbase Lite Under the Hood

Custom%User%AuthenEcaEon

Sync!Gateway

Session!Key!Generator

Custom!App!Server

Couchbase!Lite

LDAP,!etc.

Auth Auth

Back

Page 75: Webinar - Couchbase Lite Under the Hood

Custom%User%AuthenEcaEon

Sync!Gateway

Session!Key!Generator

Custom!App!Server

Couchbase!Lite

LDAP,!etc.

Auth Auth

Back

Page 76: Webinar - Couchbase Lite Under the Hood
Page 77: Webinar - Couchbase Lite Under the Hood

Data%Structures%for%Conflict%DetecEon%and%Management

Page 78: Webinar - Couchbase Lite Under the Hood

Revision%Trees

1

2

3

1

2

1

2

44

33

4

5 5

33

44

5

4 4

Page 79: Webinar - Couchbase Lite Under the Hood
Page 80: Webinar - Couchbase Lite Under the Hood

Get%Started

Page 81: Webinar - Couchbase Lite Under the Hood
Page 82: Webinar - Couchbase Lite Under the Hood

Get%Started

mobile.couchbase.com

Sample%App

hUps://github.com/couchbaselabs/TodoLite>PhoneGap

Couchbase%Cloud

hUp://www.couchbasecloud.com

Page 83: Webinar - Couchbase Lite Under the Hood
Page 84: Webinar - Couchbase Lite Under the Hood

Couchbase%Cloud

Page 85: Webinar - Couchbase Lite Under the Hood
Page 86: Webinar - Couchbase Lite Under the Hood

Q/A


Top Related