webinar: couchbase for mobile - introduction to couchbase lite

47

Upload: couchbase

Post on 20-Aug-2015

3.044 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite
Page 2: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Couchbase for Mobile

Jessica Liu – Product Manager

J. Chris Anderson – Mobile Architect

Page 3: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Couchbase Lite

The only Native NoSQL Database for

Mobile

Page 4: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

MainframeGreen Terminal

Millions of users

Thousands of Apps

PC Client/ServerLAN/Internet

Hundreds of Millions of users

Tens of Thousands

of Apps

CloudMobile Devices & Apps

Trillions of Things

Billions of users

Millions of Apps

Mobile – The Next Generation Platform

1980 1990 2020+2000 2010

Page 5: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Mobile – The Next Generation of Apps

Couchbase Server

Single User Interaction - Voice, Text - Personal Apps

Multi-User Interactions - Group and Social (Facebook, Games, Video)

Local Sensor Applications e.g., Medical

Interactingwith Enterprises

Page 6: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

JSON Anywhere

Couchbase Server

• JSON on the device Developers

increasingly prefer NoSQL database

• JSON on the wire No need for data

transformation

• JSON in the cloud Flexible data model High performance Easy scalability

JS N

JS N

JS N

Page 7: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

The Complete Mobile Solution

Page 8: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Architecture

Server 3Server 1 Server 2

Couchbase Server

Channel

Sync Gateway

Channel Channel

Sync Gateway

Channel

Couchbase Lite for iOS and Android

On Premise In the cloud

Page 9: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Before Couchbase Lite…

•Locally, could use SQLite or Core Data This works well for apps using relational algebra, and/or not data-intensive However this does not suit the needs for mobile developers interested in an

intuitive and flexible data store

•For sync and storage, could use a file-sharing service like Dropbox or iCloud Not an actual database; ownership, insight, and analytics unavailable

•Or alternatively, could use MBaaS like Parse or Kinvey But, it missed out on the offline experience, and we are still very much in an

occasionally connected world; to write a good app, you need to think offline

Page 10: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Couchbase LiteThe only NoSQL Database for Mobile Devices

•Features Ultra-lightweight, secure JSON

database Native support for iOS, Android

and REST/HTML5 Full document, index and

querying and sync capabilities Powerful conflict resolution

Couchbase Lite

Android

Couchbase Lite iOS

Page 11: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Couchbase LiteFull Feature List

Features Benefits

Native APIs Manage your mobile database using APIs optimized specifically for iOS and Android

REST APIs REST APIs provide an alternative access method based on your development needs

JSON support Use a flexible data model designed for mobile object-oriented apps. Adapt to your application needs with immediacy and little impact

Easy sync with Couchbase Sync Gateway Get sync-ready in less than a few lines of code. Focus on application development, not syncing

Peer to peer support via REST APIs

Communicate with nearby devices, even offline, with our REST API-enabled P2P support

Data routing via channels Get users only the data they need for a focused, relevant app experience

Changes Feed

Provides developers visibility and notification into data changes

Indexing and querying for JSON Use powerful secondary indexes to query your data on the device

Authentication plug-ins Use popular existing third-party authentication services like Facebook and Mozilla Person instead of writing your own

Attachment support on device and in the cloud Manage binary data, like photos and large files, separately from your JSON documents for optional, speedier sync

Page 12: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

What you get

Couchbase Lite

Android

Couchbase Lite iOS

Enable new class of rich data intensive local applications

Rapid development using native JSON data

Highly responsive interactive applications

Always available - online or offline

Page 13: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

What you get

JSON Anywhere

•Flexible JSON on device lets you work with local data & modify your data structure on the fly without impacting your back-end.

•Your users can count on having an amazing app experience with a fast and unbreakable local database

Easy Sync

•Effortlessly sync local data with a database in the cloud for updates, replication or collaborative sharing.

•In addition, scale your data tier horizontally and reliably as your data and sync needs grow.

JSONJSONJSON

JSONJSON

Page 14: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

IntegrationsCouchbase Lite Plug-in for PhoneGap

• Support for HTML5 developers• Develop once in JavaScript and deploy

on iOS & Android• Available on GitHub, Cordova Plugin

Registry, and coming soon to build.phonegap.com

https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin

http://plugins.cordova.io/#/com.couchbase.lite.phonegap

Page 15: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

IntegrationsCouchbase Lite for Xamarin

• Partnered to support C# community• Available on Developer Center• Includes sample application to help

developers get started today

http://components.xamarin.com/view/couchbase-lite/

Page 16: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

IntegrationsCouchbase Lite Titanium

• Build rich native apps for iOS & Android using JavaScript SDK

• Now available on the Appcelerator Marketplace

https://github.com/couchbaselabs/couchbase-lite-titanium/

https://marketplace.appcelerator.com/apps/6706?1396013098

Page 17: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Couchbase Sync GatewayEasy, Reliable Data Sync to the Cloud

•Features• Dynamic sync capabilities via Sync

Function APIs• Easy Administration• Seamless scaleout

•Benefits 10x reduction in development

time Scales to support millions of users

Page 18: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

How does sync work?

Page 19: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Collaborate using Channels

•For each document, you specify a set of channels it belongs to

•For each user or device, you control which channels they can access

•Replicate only a subset of documents down to the device User-defined filter functions Simply lets you know whether a document should be replicated

•And you can authenticate users

Page 20: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Doc 1 Channel A

Doc 2

Channel A

Channel B

Channel A & B

Channel B

Doc 1Doc 2

Doc 2

Page 21: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Data Routing

Data

Data

Data

Data

Page 22: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Data Routing

Data

Data

DataData

Data

Data

Page 23: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Data Routing

Data Data

DataData

Data

Data

Data

Data

Page 24: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Data Routing

Data

Data

DataData

DataData

Data

Data

Data

Data

Page 25: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Data Routing

Data

Data

DataData

Dat

aDat

a DataData

Data

Data

Data

Data

Page 26: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Data Routing

Data

Data

Data

Data

Dat

aDat

a DataData

Data

Data

Data

Data

Page 27: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

The Power of Mobile - LearningThen Now

Classrooms, Whiteboards, One-Size-Fits-All Learning

Multi-Media, Self-Paced, Adaptive,Interactive, Anywhere Anytime

Page 28: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

The Power of Mobile - Point of SaleThen Now

Big + odd looking machines, receipt printers, cash drawers

Simple, elegant tablet + square reader, email receipts, touch signing

Page 29: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

The Power of Mobile - ExpensesThen Now

Paper receipts, manual spreadsheet entry, paper signature routing

Email/photo receipt, e-routing, e-signature

Page 30: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

How do I get started?

Zero to sync in 5

minutes !!!

Page 31: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

A little deep dive

• Get familiar with Couchbase Lite through looking at an application

• Introduce the app with a demo create a list / live query my lists create some tasks / live query tasks sign in to the cloud collaborate via the cloud

• Show the code for the features as we use them

Page 32: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Application Runtime (OS Process)

StorageStorage

Couchbase LiteCouchbase Lite

Native Application LogicNative Application Logic

Sync

Page 33: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Couchbase Lite Components

Key-ValueKey-ValueJSON JSON

StorageStorage

Sync Sync EngineEngine

Map/ReduceMap/ReduceView IndexerView Indexer

Query EngineQuery Engine

Application APIApplication API

Page 34: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Application Runtime (OS Process)

StorageStorage

Couchbase LiteCouchbase Lite

Native Application LogicNative Application Logic

Sync

Page 35: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

PhoneGap Plugin

StorageStorage

Couchbase LiteCouchbase Lite

SyncREST ConnectorREST Connector

Web RuntimeWeb Runtime

PhoneGap PhoneGap PluginsPlugins

Camera, etcCamera, etc JavaScriptJavaScriptApplication LogicApplication Logic

XHR AjaxXHR Ajax

getURL(function(err, url){getURL(function(err, url){console.log(url)console.log(url)})})

Page 36: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Demo Features

JSON / REST interface

-CRUD operations use HTTP verbs

-Works with libraries like jQuery and BackboneLive Query UI Updates

-UI updated to reflect database changes, even for remote changes

-HTTP long poll API to support quick redraw

Collaborate via Cloud-social network login

-programmable sync function for update validation and channel routing

Page 37: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

JSON Document Schema

Page 38: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

All Todo Lists

•Rendered with HTML and JavaScript

•View query to show all the lists on a device.

•Form submit event creates a document representing a list.

Page 39: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Task List - Items

•Toggle a checkbox

•Add a photo

•Live update

Page 40: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Toggle a Task Checkboxby updating the JSON Document

Uses a familiar REST paradigm. GET and PUT used here.

Page 41: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Live Update UI

Local and remote updates both trigger a database event, used for redraw.

Page 42: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Sign-in to sync and collaborate

•Example uses Facebook, we support a wide variety of authentication option

•Pick from the list of signed in users when sharing

Page 43: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Photo Attachment

Page 44: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Sync Gateway Components

SyncSyncREST APIREST API

Couchbase Couchbase Smart Smart ClientClient

Revision/Revision/Conflict Conflict

ManagemeManagementnt

AuthenticatiAuthenticationon

AppApp’’s Sync s Sync FunctionFunction

Channel Channel Change Change TrackingTracking

External External Auth Auth

ServicesServices

to client

to Couchbase Server

Page 45: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Sync Function

•Application code run in the cloud

•Access control

•Channel routing

•Update Validation

Your cloud in one page of code.

Page 46: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Sync Gateway: App Logic & Storage

Couchbase Couchbase Smart Smart ClientClient

Revision/Revision/Conflict Conflict

ManagemeManagementnt

AppApp’’s Sync s Sync FunctionFunction

to Couchbase Server

function(doc, oldDoc) {…requireUser(oldDoc.owner);…channel(doc.channel);…access(doc.members, doc.roomID);}

function(doc, oldDoc) {…requireUser(oldDoc.owner);…channel(doc.channel);…access(doc.members, doc.roomID);}

validation

validationroutingroutingaccess access ctrlctrl

rev 1 rev 2

rev 3a

rev 3b

AuthenticatiAuthenticationon

Page 47: Webinar: Couchbase for Mobile - Introduction to Couchbase Lite

Get Started

mobile.couchbase.com

Sample App

https://github.com/couchbaselabs/TodoLite-PhoneGap

Couchbase Cloud

http://www.couchbasecloud.com