Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

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

301 views

Published on

In this session you’ll learn how to develop applications using Couchbase Mobile’s database API, synchronization, and security. James and Jim will cover Couchbase Lite’s CRUD, query, and synchronization APIs for managing and accessing app data. They will also demo Sync Gateway’s synchronization capabilities, including how to resolve data conflicts. Last, you’ll learn how to add security to your application.

Published in: Software
  • Be the first to comment

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

  1. 1. ©2016 Couchbase Inc. Develop: Data Management, Sync, and Security 1
  2. 2. ©2016 Couchbase Inc. 2 Jim Borden Software Engineer jim.borden@couchbase.com @borrrden IMAGE GOES HERE
  3. 3. ©2016 Couchbase Inc. 3 James Nocentini TechnicalWriter jamesn@couchbase.com @jamiltz IMAGE GOES HERE
  4. 4. ©2016 Couchbase Inc.©2016 Couchbase Inc. Agenda • Couchbase Lite • Local Database • With Synchronization • Conflict Resolution • Supported Platforms • Sync Gateway • Sync Function • Integration • App Servers • Peer-to-peer • DifferentTopologies 4
  5. 5. ©2016 Couchbase Inc. 5 Couchbase Lite The Database
  6. 6. ©2016 Couchbase Inc.©2016 Couchbase Inc. Couchbase Lite Development 6 C#Objective-C / SwiftJava + others Hybrid Native Native with JS
  7. 7. ©2016 Couchbase Inc.©2016 Couchbase Inc. Creating a Database • A database is simply a collection of documents • Server-less architecture; All logic is embedded in the application 7
  8. 8. ©2016 Couchbase Inc.©2016 Couchbase Inc. Document Operations 8 // Get the database (and create it if it doesn't exist) let database = CBLManager.sharedInstance().databaseNamed("user1") // Create a new document (i.e. a record let document = database.createDocument() document.putProperties(["task": "Apples"]) // Update a document document.update { (newRevision) -> Bool in newRevision["task"] = "Red apples" return true } // Delete a document document.delete()
  9. 9. ©2016 Couchbase Inc.©2016 Couchbase Inc. Pre-built Database 9
  10. 10. ©2016 Couchbase Inc.©2016 Couchbase Inc. Creating an Index 10
  11. 11. ©2016 Couchbase Inc.©2016 Couchbase Inc. Data Aggregation 11
  12. 12. ©2016 Couchbase Inc. 12 Couchbase Lite Syncing
  13. 13. ©2016 Couchbase Inc.©2016 Couchbase Inc. Starting Replications 13
  14. 14. ©2016 Couchbase Inc.©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 14
  15. 15. ©2016 Couchbase Inc.©2016 Couchbase Inc. Example: N-way merge 15 Type = Task Name = Text Complete = false Type = Task Name = Text Changed Complete = false Type = Task Name = Potatoes Complete = true Type = Task Name = Text Changed Complete = true
  16. 16. ©2016 Couchbase Inc. 16 Sync Gateway Sync Function
  17. 17. ©2016 Couchbase Inc.©2016 Couchbase Inc. Security Model • Data routing • Channels • Read access • Access method • Write access • requireUser • requireAccess • requireRole 17
  18. 18. ©2016 Couchbase Inc.©2016 Couchbase Inc. Channels 18 Channels Users ch 1 ch 2 User 1 User 2 ch 1 Documents ch 3 Roles 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
  19. 19. ©2016 Couchbase Inc. 19 Integration With Other Systems
  20. 20. ©2016 Couchbase Inc.©2016 Couchbase Inc. Flexible REST APIs • Stream changes • Bulk operations • HTTP clients in different languages 20
  21. 21. ©2016 Couchbase Inc.©2016 Couchbase Inc. Peer-to-peer • Connect and exchange data directly • Different topologies • Same application code 21
  22. 22. ©2016 Couchbase Inc.©2016 Couchbase Inc. DemoTopology 22 Sync Gateway Windows AppAndroid App LAN Network
  23. 23. ©2016 Couchbase Inc. ThankYou! 23

×