24
OFFLINE FIRST AND SEARCH ON STEROIDS VEGARD HAUGSTVEDT ITERA

Offline first with Couchbase Mobile

Embed Size (px)

Citation preview

Page 1: Offline first with Couchbase Mobile

OFFLINE FIRST

AND SEARCH ON STEROIDS

VEGARD HAUGSTVEDTITERA

Page 2: Offline first with Couchbase Mobile

@IT_VEGARD

OFFLINE-FIRST?

25.06.2016 / 2

Page 3: Offline first with Couchbase Mobile

@IT_VEGARD 25.06.2016 / 3

Page 4: Offline first with Couchbase Mobile

@IT_VEGARD

Couchbase Server

25.06.2016 / 4

• Scalable

• High performance

• Available

• NoSQL

• Document database

• Schemaless

• Key-value store

• Distributed cache

• N1QL

Page 5: Offline first with Couchbase Mobile

@IT_VEGARD

Couchbase Mobile

25.06.2016 / 5

Page 6: Offline first with Couchbase Mobile

@IT_VEGARD

Features

25.06.2016 / 6

• Embedded database

• Synchronization

• Security

• Events

• REST API

• Stream & batch API

• JSON

• Database Server

Page 7: Offline first with Couchbase Mobile

@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

Page 8: Offline first with Couchbase Mobile

@IT_VEGARD

Couchbase Lite

25.06.2016 / 8

• Lightweight

• Native and embedded

• Local first

• Implicit offline-support

Page 9: Offline first with Couchbase Mobile

@IT_VEGARD

Couchbase Sync Gateway

25.06.2016 / 9

• Replication

• Authentication

• Access control

• Data routing

• Validation

Page 10: Offline first with Couchbase Mobile

@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

Page 11: Offline first with Couchbase Mobile

@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

Page 12: Offline first with Couchbase Mobile

@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

Page 13: Offline first with Couchbase Mobile

@IT_VEGARD

Couchbase Mobile

25.06.2016 / 13

Page 14: Offline first with Couchbase Mobile

@IT_VEGARD

SO, HOW ABOUT SOME CODE?

25.06.2016 / 14

Page 15: Offline first with Couchbase Mobile

@IT_VEGARD

1. Get database

25.06.2016 / 15

Page 16: Offline first with Couchbase Mobile

@IT_VEGARD

2. Create documents

25.06.2016 / 16

Page 17: Offline first with Couchbase Mobile

@IT_VEGARD

3. Update documents

25.06.2016 / 17

Page 18: Offline first with Couchbase Mobile

@IT_VEGARD

4. Delete documents

25.06.2016 / 18

Page 19: Offline first with Couchbase Mobile

@IT_VEGARD

5. Replication

25.06.2016 / 19

Page 20: Offline first with Couchbase Mobile

@IT_VEGARD

6. Authentication

25.06.2016 / 20

Page 21: Offline first with Couchbase Mobile

@IT_VEGARD

7. Change listeners

25.06.2016 / 21

Page 22: Offline first with Couchbase Mobile

@IT_VEGARD

8. Get started!

25.06.2016 / 22

Page 23: Offline first with Couchbase Mobile

@IT_VEGARD

MOBILE DATABASE+

SYNCHRONIZATIONIN

28 LINES OF CODE!

25.06.2016 / 23

Page 24: Offline first with Couchbase Mobile

@IT_VEGARD

TWITTER: @IT_VEGARD

GITHUB: IT-VEGARD

25.06.2016 / 24