Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Couchbase Mobile on Android

Couchbase Mobile on Android

Avatar for James Nocentini

James Nocentini

September 04, 2015

More Decks by James Nocentini

Other Decks in Technology

Transcript

  1. Couchbase Mobile features • Replication • Transparent availability of data

    on server & client • Full offline functionality • Data orchestration • Smart routing of data to its users • Subsetting data sets for different use cases goo.gl/yuhnvt
  2. Couchbase Lite • Embedded database library for mobile apps •

    Flexible, schemaless data model ("NoSQL") • Querying by map/reduce views • Active change notifications, for reactive UIs • Full-strength multi-master replication goo.gl/yuhnvt
  3. Replicating Documents & Revisions B: "What’s new since we last

    spoke?" A: "I added rev #3-a9ff of doc1." B: "That’s new to me!" A: "I’ll send it over…" doc1 3-a9ff doc1 2-c31b A B
  4. Sync Function • Read: access • Write: requireAccess, requireUser, requireRole

    • Grant a user access to multiple channels by simply assigning a role • Any user can give another user access goo.gl/yuhnvt
  5. Channels, roles and users goo.gl/yuhnvt User 1 User 2 User

    3 Channel X Channel Y Channel Z Channel X Channel Y Channel Z Channel X Channel Y Channel Z
  6. Channels, roles and users goo.gl/yuhnvt User 1 User 2 User

    3 Role Channel X Channel Y Channel Z
  7. Channels, roles and users goo.gl/yuhnvt User 1 User 2 User

    3 Role Channel X Channel Y Channel Z
  8. Conflicts { "_id": "james", "_rev": "1-bf30-03if-80dw-19sk", "rating": 4, "type": "conflict"

    } Result (in turn scenario = no conflict) goo.gl/yuhnvt doc1 (rev-1) doc1 (rev-1) { "_id": "james", "_rev": "1-bf30-03if-80dw-19sk", "rating": 4, "type": "conflict" }
  9. Conflicts { "_id": "james", "_rev": "1-bf30-03if-80dw-19sk", "rating": 4, "type": "conflict"

    } Result (in turn scenario = no conflict) goo.gl/yuhnvt doc1 (rev-1) doc1 (rev-2) { "_id": "james", "_rev": "1-bf30-03if-80dw-19sk", "rating": 4, "type": "conflict" }
  10. Conflicts { "_id": "james", "_rev": "1-bf30-03if-80dw-19sk", "rating": 4, "type": "conflict"

    } Result (both offline scenario = conflict) goo.gl/yuhnvt doc1 (rev-1) doc1 (rev-1’)
  11. Conflicts { "_id": "james", "_rev": "1-bf30-03if-80dw-19sk", "rating": 4, "type": "conflict"

    } Result (both offline scenario = conflict) goo.gl/yuhnvt doc1 (rev-1) doc1 (rev-1’) doc1 (rev-1)
  12. Peer-To-Peer URL url = new URL("http://10.8.4.3:5984/votingapp");
 Replication r = Replication.createPushReplication(url);


    r.start(); Result doc1 doc1 Credentials credentials = new Credentials("", "");
 LiteListener listener = new LiteListener(manager, 5984, credentials);
 listener.start(); B A A B
  13. Benefits Of Peer-To-Peer • End-user privacy • Unmetered high bandwidth

    connections • Useable with no Internet infrastructure • Cellular "dead zones" • Wilderness • Disaster areas goo.gl/yuhnvt
  14. Drawbacks Of Peer-To-Peer • Less reliable • Hard to securely

    identify users or authenticate content • Difficult to scale up • On a LAN: Bandwidth growth • Beyond a LAN: Connectivity and peer discovery goo.gl/yuhnvt
  15. Hybrid Approaches • "A server is just a well-connected peer"

    • Clients can connect to local peers and to a server
  16. More Information James Nocentini Developer Advocate @jamiltz, [email protected] RatingApp on

    GitHub http://github.com/couchbaselabs/mini-hacks/rating-app