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

23
©2016 Couchbase Inc. Develop: Data Management, Sync, and Security 1

Upload: couchbase

Post on 15-Apr-2017

160 views

Category:

Software


4 download

TRANSCRIPT

Page 1: Develop: data management, sync and security – Couchbase Connect 2016

©2016 Couchbase Inc. 1

Develop: Data Management, Sync, and

Security

Page 2: Develop: data management, sync and security – Couchbase Connect 2016

©2016 Couchbase Inc. 2

Jim BordenSoftware [email protected]@borrrden

IMAGE GOES HERE

Page 3: Develop: data management, sync and security – Couchbase Connect 2016

©2016 Couchbase Inc. 3

James NocentiniTechnical [email protected]@jamiltz

IMAGE GOES HERE

Page 4: Develop: data management, sync and security – Couchbase Connect 2016

©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

Page 5: Develop: data management, sync and security – Couchbase Connect 2016

©2016 Couchbase Inc. 5

Couchbase LiteThe Database

Page 6: Develop: data management, sync and security – Couchbase Connect 2016

©2016 Couchbase Inc. 6©2016 Couchbase Inc.

Couchbase Lite Development

C#Objective-C / SwiftJava

+ others

Hybrid

Native

Native with JS

Page 7: Develop: data management, sync and security – Couchbase Connect 2016

©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

Page 8: Develop: data management, sync and security – Couchbase Connect 2016

©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()

Page 9: Develop: data management, sync and security – Couchbase Connect 2016

©2016 Couchbase Inc. 9©2016 Couchbase Inc.

Pre-built Database

Page 10: Develop: data management, sync and security – Couchbase Connect 2016

©2016 Couchbase Inc. 10©2016 Couchbase Inc.

Creating an Index

Page 11: Develop: data management, sync and security – Couchbase Connect 2016

©2016 Couchbase Inc. 11©2016 Couchbase Inc.

Data Aggregation

Page 12: Develop: data management, sync and security – Couchbase Connect 2016

©2016 Couchbase Inc. 12

Couchbase LiteSyncing

Page 13: Develop: data management, sync and security – Couchbase Connect 2016

©2016 Couchbase Inc. 13©2016 Couchbase Inc.

Starting Replications

Page 14: Develop: data management, sync and security – Couchbase Connect 2016

©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

Page 15: Develop: data management, sync and security – Couchbase Connect 2016

©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

Page 16: Develop: data management, sync and security – Couchbase Connect 2016

©2016 Couchbase Inc. 16

Sync GatewaySync Function

Page 17: Develop: data management, sync and security – Couchbase Connect 2016

©2016 Couchbase Inc. 17©2016 Couchbase Inc.

Security Model

• Data routing• Channels

• Read access• Access method

• Write access• requireUser• requireAccess• requireRole

Page 18: Develop: data management, sync and security – Couchbase Connect 2016

©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

Page 19: Develop: data management, sync and security – Couchbase Connect 2016

©2016 Couchbase Inc. 19

IntegrationWith Other Systems

Page 20: Develop: data management, sync and security – Couchbase Connect 2016

©2016 Couchbase Inc. 20©2016 Couchbase Inc.

Flexible REST APIs

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

Page 21: Develop: data management, sync and security – Couchbase Connect 2016

©2016 Couchbase Inc. 21©2016 Couchbase Inc.

Peer-to-peer

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

Page 22: Develop: data management, sync and security – Couchbase Connect 2016

©2016 Couchbase Inc. 22©2016 Couchbase Inc.

Demo Topology

Sync Gateway

Windows AppAndroid App

LAN Network

Page 23: Develop: data management, sync and security – Couchbase Connect 2016

©2016 Couchbase Inc. 23

Thank You!