Download - Intro_to_Couchbase_lite_tokyo_14
Couchbase for Mobile
Jessica Liu – Product Manager
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
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
S e r v e rS y n c G a t e w a yL i t e
JS N
JS N
JS N
The Complete Mobile Solution
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
Couchbase Lite
The only Native NoSQL Database for
Mobile
Couchbase LiteThe only NoSQL Database for Mobile Devices
L i t e
Couchbase Lite
Android
Couchbase Lite iOS
• 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
非常に軽量で安全な JSON形式のデータベース
iOS、 Androidをネイティブサポート
ドキュメント作成、インデックス、クエリ、シンクが可能
コンフリクト発生時の対応
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 Persona 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
What you get
L i t e
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オンライン、オフライン問わず、常にデータにアクセス可能
高速な対話型のアプリケーション
JSONでスピーディな開発が可能
これまでにはないデータのクラスをローカルアプリケーションに提供
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
S y n c G a t e w a y
Sync Function APIで動的なデータのシンクが可能
分かりやすい管理ツール
手間のかからないスムーズなスケールアウト
開発時間が従来の 10分の1に短縮
ビッグユーザをサポート
How does sync work?
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
各ドキュメントにチャネルを設定
ユーザまたはモバイル端末に対し、チャネルへのアクセスを制限
全ドキュメントの中から(チャネルに関連付けられた)ドキュメントのみを複製
ユーザ認証機能
Doc 1 Channel A
Doc 2
Channel A
Channel B
Channel A & B
Channel B
Doc 1Doc 2
Doc 2
Sync Gateway
Dat
aD
ata
Dat
aD
ata
Sync Gateway
Dat
aD
ata
DataData
Dat
aD
ata
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 ctrl
access ctrl
Sync Function
Sync Gateway
Data Data
DataData
Dat
aD
ata
Dat
aD
ata
Sync Gateway
DataData
DataData
DataData
Dat
aD
ata
Dat
aD
ata
Sync Gateway
Data
Data
DataData
Data
Data
DataData
Dat
aD
ata
Dat
aD
ata
Sync Gateway
Data
Data
DataData
Data
Data Data
Data
Dat
aD
ata
Dat
aD
ata
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
柔軟な JSONデータをモバイルに持たせることにより、バックエンドに影響を与えることなくローカルのデータを簡単に変更することができる
ユーザは非常に高速かつ保障されたローカルのデータベースにアクセスすることができる
ローカルとクラウド上にあるデータを容易にシンクさせることができる(アップデート、レプリケーション、 etc)
データ量やシンクの増加に伴い、データベースを水平方向に拡張することができる
Live Demo & Quick Look
Getting Up And Running
• Download Couchbase Lite
• Download ToDo Lite sample code
• Copy framework into sample app folder
• Build & Run
1. Download Couchbase Lite
www.couchbase.com/download
2. Download ToDo Lite for iOSgithub.com/couchbaselabs/ToDoLite-iOS
3. Plug In The Framework
• optionoption
Live Demo
Quick Look
Application Runtime (OS Process)
StorageStorage
Couchbase LiteCouchbase Lite
Native Application LogicNative Application Logic
Sync
Couchbase Lite Components
Key-ValueKey-ValueJSON JSON StorageStorage
Sync Sync EngineEngine
Map/ReduceMap/ReduceView IndexerView Indexer
Query EngineQuery Engine
Application APIApplication API
JSON document schema for ToDo Lite
All Todo Lists
•A view is created to show all the lists on a device
•Form submit event creates a document representing a list
クエリを表示して、端末上のリストを表示させる
ドキュメントの作成
Task List - Items
•Toggle a checkbox
•Live update
チェックを入れる
自動アップデート
Toggle a Task Checkboxby updating the JSON Document
Live Query Update
Sync Gateway Components
SyncSyncREST APIREST API
Couchbase Couchbase Smart ClientSmart Client
Revision/CoRevision/Conflict nflict
ManagementManagement
AuthenticationAuthentication
AppApp’’s Sync s Sync FunctionFunction
Channel Channel Change Change TrackingTracking
External Auth External Auth ServicesServices
to client
to Couchbase Server
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
Facebookの例:認証オプションの機能をサポート
情報を共有する場合は、サインインしているユーザを選択
Sync Function
•Application code run in the cloud
•Access control
•Channel routing
•Update Validation
Your cloud in one page of code.
クラウド上で実行されるアプリケーションコード
アクセス制御
チャネル経路の指定
更新データのチェック
Sync Gateway: App Logic & Storage
Couchbase Couchbase Smart ClientSmart Client
Revision/CoRevision/Conflict nflict
ManagementManagement
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 ctrl
access ctrl
rev 1 rev 2
rev 3a
rev 3b
AuthenticationAuthentication
How do I get started?
Get Started
mobile.couchbase.com
Sample App
https://github.com/couchbaselabs/TodoLite-iOS
Couchbase Cloud
http://www.couchbasecloud.com
Additional Resources
Webinar Series: www.couchbase.com/webinars
Developing with Couchbase Lite iOS
Developing with Couchbase Lite Android
Couchbase Lite Under the Hood
Community Forumhttps://groups.google.com/forum/#!forum/mobile-couchbase
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
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/
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
Q&A