Upload
vegard-haugstvedt
View
48
Download
0
Embed Size (px)
Citation preview
OFFLINE FIRST
AND SEARCH ON STEROIDS
VEGARD HAUGSTVEDTITERA
@IT_VEGARD
OFFLINE-FIRST?
25.06.2016 / 2
@IT_VEGARD 25.06.2016 / 3
@IT_VEGARD
Couchbase Server
25.06.2016 / 4
• Scalable
• High performance
• Available
• NoSQL
• Document database
• Schemaless
• Key-value store
• Distributed cache
• N1QL
@IT_VEGARD
Couchbase Mobile
25.06.2016 / 5
@IT_VEGARD
Features
25.06.2016 / 6
• Embedded database
• Synchronization
• Security
• Events
• REST API
• Stream & batch API
• JSON
• Database Server
@IT_VEGARD
Use cases
25.06.2016 / 7
• Offline data access
• Local caching
• Content delivery and storage
• Real-time asset tracking
• Peer-to-peer device usage
• User data and preferences storage
@IT_VEGARD
Couchbase Lite
25.06.2016 / 8
• Lightweight
• Native and embedded
• Local first
• Implicit offline-support
@IT_VEGARD
Couchbase Sync Gateway
25.06.2016 / 9
• Replication
• Authentication
• Access control
• Data routing
• Validation
@IT_VEGARD
Authentication
• Basic Authentication w/username and password
• OpenID Connect Authentication (Google, PayPal, etc)
• Static providers (Facebook, Google+ and OpenID
providers)
• Custom authentication through App Server
25.06.2016 / 10
@IT_VEGARD
Channels and the sync function
• Authorizes which channels a user can access
• Sync function– Evaluates changes– Assigns documents to one or more channels
• Replicate only the channels you want
25.06.2016 / 11
@IT_VEGARD
Conflict handling
1. The undeleted leaf on the longest revision branch
2. The deleted leaf on the longest branch
3. The leaf with the revision ID which sorts higher in ASCII comparison (!)
25.06.2016 / 12
@IT_VEGARD
Couchbase Mobile
25.06.2016 / 13
@IT_VEGARD
SO, HOW ABOUT SOME CODE?
25.06.2016 / 14
@IT_VEGARD
1. Get database
25.06.2016 / 15
@IT_VEGARD
2. Create documents
25.06.2016 / 16
@IT_VEGARD
3. Update documents
25.06.2016 / 17
@IT_VEGARD
4. Delete documents
25.06.2016 / 18
@IT_VEGARD
5. Replication
25.06.2016 / 19
@IT_VEGARD
6. Authentication
25.06.2016 / 20
@IT_VEGARD
7. Change listeners
25.06.2016 / 21
@IT_VEGARD
8. Get started!
25.06.2016 / 22
@IT_VEGARD
MOBILE DATABASE+
SYNCHRONIZATIONIN
28 LINES OF CODE!
25.06.2016 / 23
@IT_VEGARD
TWITTER: @IT_VEGARD
GITHUB: IT-VEGARD
25.06.2016 / 24