webinar - couchbase lite under the hood
DESCRIPTION
In this webinar we'll take a deep dive into Couchbase Lite's architecture. We'll be starting with an overview of Couchbase Lite concepts, and how those concepts have been realized in Couchbase Lite and Couchbase Sync Gateway. In this webinar you will see: Key concepts behind Couchbase Lite and the Couchbase mobile strategy A detailed overview of the Couchbase Lite components A technical overview of Couchbase Sync Gateway Examples of APIs (REST, iOS, Android)TRANSCRIPT
Couchbase*Lite*Under*the*Hood*
J.*Chris*Anderson*–*Mobile*Architect*
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!
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*
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
Couchbase*Server*IndustryKleading*NoSQL*database*
• MulMple*deployment*opMons*
OnBPremise* Hosted*on*Amazon* Cloud*Services*
• Couchbase*Cloud*• KuroBase*
Server
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*
Sync%Architecture
Server%3Server%1 Server%2
Couchbase%Server
Architecture
Server%3Server%1 Server%2
Couchbase%Server
On Premise In the cloud
Architecture
Server%3Server%1 Server%2
Couchbase%Server
Channel
Sync%Gateway
Channel Channel
Sync%Gateway
Channel
On Premise In the cloud
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
!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
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
A%Day%in%the%Life%of%a%Document
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
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�
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
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
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
Embedded%Database
Couchbase%Lite%Components
KeyAValueJSON!
Storage
Sync!Engine
Map/ReduceView!Indexer
Query!Engine
ApplicaHon!API
Couchbase%Lite%Components
KeyAValueJSON!
Storage
Sync!Engine
Map/ReduceView!Indexer
Query!Engine
ApplicaHon!API
Couchbase%Lite%Components
KeyAValueJSON!
Storage
Sync!Engine
Map/ReduceView!Indexer
Query!Engine
ApplicaHon!API
Couchbase%Lite%Components
KeyAValueJSON!
Storage
Sync!Engine
Map/ReduceView!Indexer
Query!Engine
ApplicaHon!API
Couchbase%Lite%Components
KeyAValueJSON!
Storage
Sync!Engine
Map/ReduceView!Indexer
Query!Engine
ApplicaHon!API
Couchbase%Lite%Components
KeyAValueJSON!
Storage
Sync!Engine
Map/ReduceView!Indexer
Query!Engine
ApplicaHon!API
Live%QueryObjecEve>C%code%example
Mobile%ApplicaEon%Process
Storage
Couchbase!Lite
NaHve!ApplicaHon!Logic
Sync
PhoneGap%Plugin
Storage
Couchbase!Lite
SyncREST!Connector
Web!RunHme
PhoneGap!Plugins
Camera,!etcJavaScript
ApplicaHon!Logic
XHR!Ajax
getURL(function(err,0url){console.log(url)
})
Toggle&a&Task&Checkbox&by&upda3ng&the&JSON&Document
REST%to%GET%and%PUT%documents
Toggle&a&Task&Checkbox&by&upda3ng&the&JSON&Document
SelecEve%Sync
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
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
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
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
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
Doc%1 Channel%A
Doc%1 Channel%A
Doc%2Channel%A
Channel%B
Channel%A%&%B
Channel%B
Doc%1 Channel%A
Doc%2Channel%A
Channel%B
Channel%A%&%B
Channel%B
Doc%1 Channel%A
Doc%2Channel%A
Channel%B
Channel%A%&%B
Channel%B
Doc%1Doc%2
Doc%1 Channel%A
Doc%2Channel%A
Channel%B
Channel%A%&%B
Channel%B
Doc%1Doc%2
Doc%1 Channel%A
Doc%2Channel%A
Channel%B
Channel%A%&%B
Channel%B
Doc%1Doc%2
Doc%2
Data Routing
Dat
aD
ata
Data Routing
Dat
a
Data
Dat
a
Data Routing
Data
Data
Dat
aD
ata
Data RoutingDa
ta
Data
Data
Dat
aD
ata
Data RoutingDa
ta
Data
Data Data
Dat
aD
ata
Data RoutingDa
ta
Data
DataData
Dat
aD
ata
Sync%Gateway
Architecture
Server%3Server%1 Server%2
Couchbase%Server
Channel
Sync%Gateway
Channel Channel
Sync%Gateway
Channel
Couchbase%Lite%for%iOS%and%Android
Sync%Gateway:%App%Logic%&%Storage
Couchbase!Smart!Client
Revision/Conflict!
Management
App’s!Sync!FuncHon
to'Couchbase'Server
AuthenHcaHon
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
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
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
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
Sync%Gateway:%App%Logic%&%Storage
Couchbase!Smart!Client
Revision/Conflict!
Management
App’s!Sync!FuncHon
to'Couchbase'Server
AuthenHcaHon
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
Sync%Gateway:%App%Logic%&%Storage
Couchbase!Smart!Client
Revision/Conflict!
Management
App’s!Sync!FuncHon
to'Couchbase'Server
AuthenHcaHon
Programmable Sync
Your%Cloud%in%One%Page%of%Code
• ApplicaEon%logic%run%by%the%Gateway Access%Control Channel%Rou0ng Update%Valida0on
Programmable Sync
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
Custom%User%AuthenEcaEon
Sync!Gateway
Session!Key!Generator
Custom!App!Server
Couchbase!Lite
LDAP,!etc.
Auth Auth
Back
Custom%User%AuthenEcaEon
Sync!Gateway
Session!Key!Generator
Custom!App!Server
Couchbase!Lite
LDAP,!etc.
Auth Auth
Back
Custom%User%AuthenEcaEon
Sync!Gateway
Session!Key!Generator
Custom!App!Server
Couchbase!Lite
LDAP,!etc.
Auth Auth
Back
Custom%User%AuthenEcaEon
Sync!Gateway
Session!Key!Generator
Custom!App!Server
Couchbase!Lite
LDAP,!etc.
Auth Auth
Back
Custom%User%AuthenEcaEon
Sync!Gateway
Session!Key!Generator
Custom!App!Server
Couchbase!Lite
LDAP,!etc.
Auth Auth
Back
Custom%User%AuthenEcaEon
Sync!Gateway
Session!Key!Generator
Custom!App!Server
Couchbase!Lite
LDAP,!etc.
Auth Auth
Back
Custom%User%AuthenEcaEon
Sync!Gateway
Session!Key!Generator
Custom!App!Server
Couchbase!Lite
LDAP,!etc.
Auth Auth
Back
Custom%User%AuthenEcaEon
Sync!Gateway
Session!Key!Generator
Custom!App!Server
Couchbase!Lite
LDAP,!etc.
Auth Auth
Back
Custom%User%AuthenEcaEon
Sync!Gateway
Session!Key!Generator
Custom!App!Server
Couchbase!Lite
LDAP,!etc.
Auth Auth
Back
Data%Structures%for%Conflict%DetecEon%and%Management
Revision%Trees
1
2
3
1
2
1
2
44
33
4
5 5
33
44
5
4 4
Get%Started
Get%Started
mobile.couchbase.com
Sample%App
hUps://github.com/couchbaselabs/TodoLite>PhoneGap
Couchbase%Cloud
hUp://www.couchbasecloud.com
Couchbase%Cloud
Q/A