develop: data management, sync and security – couchbase connect 2016

Post on 15-Apr-2017

160 Views

Category:

Software

4 Downloads

Preview:

Click to see full reader

TRANSCRIPT

©2016 Couchbase Inc. 1

Develop: Data Management, Sync, and

Security

©2016 Couchbase Inc. 2

Jim BordenSoftware Engineerjim.borden@couchbase.com@borrrden

IMAGE GOES HERE

©2016 Couchbase Inc. 3

James NocentiniTechnical Writerjamesn@couchbase.com@jamiltz

IMAGE GOES HERE

©2016 Couchbase Inc. 4©2016 Couchbase Inc.

Agenda

• Couchbase Lite• Local Database• With Synchronization• Conflict Resolution• Supported Platforms

• Sync Gateway• Sync Function

• Integration• App Servers

• Peer-to-peer• Different Topologies

©2016 Couchbase Inc. 5

Couchbase LiteThe Database

©2016 Couchbase Inc. 6©2016 Couchbase Inc.

Couchbase Lite Development

C#Objective-C / SwiftJava

+ others

Hybrid

Native

Native with JS

©2016 Couchbase Inc. 7©2016 Couchbase Inc.

Creating a Database

• A database is simply a collection of documents• Server-less architecture; All logic is embedded in the

application

©2016 Couchbase Inc. 8©2016 Couchbase Inc.

Document Operations

// Get the database (and create it if it doesn't exist)let database = CBLManager.sharedInstance().databaseNamed("user1")

// Create a new document (i.e. a recordlet document = database.createDocument()document.putProperties(["task": "Apples"])

// Update a documentdocument.update { (newRevision) -> Bool in newRevision["task"] = "Red apples" return true}

// Delete a documentdocument.delete()

©2016 Couchbase Inc. 9©2016 Couchbase Inc.

Pre-built Database

©2016 Couchbase Inc. 10©2016 Couchbase Inc.

Creating an Index

©2016 Couchbase Inc. 11©2016 Couchbase Inc.

Data Aggregation

©2016 Couchbase Inc. 12

Couchbase LiteSyncing

©2016 Couchbase Inc. 13©2016 Couchbase Inc.

Starting Replications

©2016 Couchbase Inc. 14©2016 Couchbase Inc.

Conflict Resolution

• Mobile data will have conflicts (CAP theorem)• Application logic dictates how they are handled• Common strategies• Deletes always win• N-way merge• Last update wins

©2016 Couchbase Inc. 15©2016 Couchbase Inc.

Example: N-way merge

Type = TaskName = TextComplete = false

Type = TaskName = Text ChangedComplete = false

Type = TaskName = PotatoesComplete = true

Type = TaskName = Text ChangedComplete = true

©2016 Couchbase Inc. 16

Sync GatewaySync Function

©2016 Couchbase Inc. 17©2016 Couchbase Inc.

Security Model

• Data routing• Channels

• Read access• Access method

• Write access• requireUser• requireAccess• requireRole

©2016 Couchbase Inc. 18©2016 Couchbase Inc.

Channels

Channels

Users

ch 1

ch 2

User 1

User 2

ch 1Documents

ch 3Roles

Role 1

Role 2

Doc 1

Doc 2

Doc 3

Role 2

ch 2

ch 3

ch 1 ch 1 ch 2

ch 2

ch 3

...

...

... ...

1

1

3

2

1

1 3

©2016 Couchbase Inc. 19

IntegrationWith Other Systems

©2016 Couchbase Inc. 20©2016 Couchbase Inc.

Flexible REST APIs

• Stream changes• Bulk operations• HTTP clients in different languages

©2016 Couchbase Inc. 21©2016 Couchbase Inc.

Peer-to-peer

• Connect and exchange data directly• Different topologies• Same application code

©2016 Couchbase Inc. 22©2016 Couchbase Inc.

Demo Topology

Sync Gateway

Windows AppAndroid App

LAN Network

©2016 Couchbase Inc. 23

Thank You!

top related