6. Features
25.06.2016 / 6
• Embedded database
• Synchronization
• Security
• Events
• REST API
• Stream & batch API
• JSON
• Database Server
@IT_VEGARD
7. 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
8. Couchbase Lite
25.06.2016 / 8
• Lightweight
• Native and embedded
• Local first
• Implicit offline-support
@IT_VEGARD
10. 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@IT_VEGARD / 10
11. 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@IT_VEGARD / 11
12. 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@IT_VEGARD / 12
[16:00]
Couchbase Lite is a lightweight, embedded NoSQL database on your device.
Couchbase Lite is based on the CouchDB replication protocol.
I say that it is local first and implicit offline-support. By that, I mean that your code on the client will just be interacting with Couchbase Lite for CRUD-operations.
Will show some code later which lets you connect to the Sync Gateway and start synchronizing.
[15:00]
Sync Gateway handles all replication, access control and filtering of documents that are synchronized to the client devices.
This makes it perhaps the most important part of this setup, and where most of the configuration happens.
I’ll go into more details about how this is done in the next few slides.
[14:00]
[13:00]
Channels are logical groupings of documents, and provide read access to users or user groups.
Sync function:
Considers access privileges, business logic and the actual content.
When synchronizing, Couchbase Lite can request select channels, or retrieve all the channels available to the user.
[12:00]
So, Couchbase will not try to merge changes, and instead provides a really simple, but perhaps stupid, algorithm for deciding which revision to use.
Selecting a «winner» is not always a good option. In that case, you need to take over.
Basically, you can check a document to see if it has conflicting revisions, and then your business logic must either choose which revision to keep or how to merge them.
You should really clear up the conflicting revisions even if your app can accept the choice Couchbase makes for you, as the conflicting revisions will stay in the database and take up space until deleted.