Share
Embed
Couchbase Lite iOS Geo
Accompanies a demo of https://github.com/couchbaselabs/PicMapper
Chris Anderson
September 12, 2014
Transcript
24 slides
-
Geo Queries in Couchbase Mobile Implementing and using Geographic indexes
Chris Anderson, Mobile Architect -
3 Couchbase Lite On-‐device, lightweight, native embedded JSON
database Sync Gateway Synchronize on-‐device Couchbase Lite with Couchbase Server in the cloud Couchbase Server High performance, scalable, always-‐on JSON database in the cloud Couchbase Mobile -
Conflict Resolution 5 Johnny (555)123-4567 Johnny Smith [email protected] 123 Main
Street Anywhere, USA (555)123-4567 Johnny Smith 123 Main Street Anywhere, USA (555)123-4567 John A. Smith [email protected] 123 Main Street Anywhere, USA (555)123-4567 John A. Smith [email protected] 123 Main Street Anywhere, USA (555)123-4567 Johnny Smith (555)123-4567 Jon A. Smith [email protected] 123 Main Street Anywhere, USA (555)123-4567 John A. Smith [email protected] 123 Main Street Anywhere, USA (555)123-4567 CONFLICT ACTIVE -
Access Control, Filtering, and Validation 9 Pluggable Authentication Javascript sync
function runs on all mutations. Access/Filtering – channel(…): Routes the document to the named channel – access(…): Grants access to a channel to a specified user, list of users, or a role – role(…): Grants a user a role Validation – throw(…): Prevents a document mutation from persisting – requireUser/Role/Access(…): Validates the user, their role assignments, or their access privileges. -
Sync Function 10 function (doc, oldDoc) { if (doc.published) {
channel ("public"); } access (”joe", ”public"); ! role (”joe", "role:admin"); ! throw ({forbidden : "read only!"}) ! requireUser(doc.owner); requireRole("admin"); requireAccess(”public"); } -
Infinite Campus Education / Social Interaction ▪ Selectively push
out learning modules / multimedia lessons to individual students ▪ Teachers and students use custom mobile chat apps for real-‐time Q&A during lectures ▪ Homework assignments can be completed offline anywhere “We needed to provide an educational experience as engaging as the apps students love to use everyday. The ability to work online/offline and seamlessly sync across devices and between users was critical to delivering the experience they need for both in the classroom, and off campus. We investigated the market for an ultra-lightweight NoSQL mobile database with easy sync and Couchbase was the only choice.” Mike Lamb, Principal Software Engineer, Infinite Campus -
Picsolve Embedded ▪ Image capture of roller coaster
riders to local database in multiple theme park locations ▪ Machine to machine communication example ▪ Unreliable network connectivity required offline capture / later sync to centralized management system -
Microsoft Peer-‐to-‐Peer ▪ What does it mean to make
the web truly peer-‐to-‐peer? ▪ Data stored on the edge ▪ Enable applications that can live on the edge of the network -
Couchbase Lite Setup Setup Steps ▪ Open database
▪ Configure sync ▪ Install index definitions -
Import Photos Loading Photos ▪ Enumerate assets ▪
Save JSON document ▪ Attach image thumbnail -
Live Query for Map Annotations Rendering Points ▪ Create
LiveQuery ▪ Observe Results ▪ Update Map Annotations -
Update Query on Region Change Bounding Box ▪ Observe
Region Changes ▪ BBox from MapRect ▪ Refresh Live Query