mobile workshop: sync gateway in-depth: couchbase connect 2015

21
COUCHBASE SYNC GATEWAY James Nocentini, Developer Advocate, Couchbase

Upload: couchbase

Post on 26-Jul-2015

312 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

COUCHBASE  SYNC  GATEWAY

James  Nocentini,  Developer  Advocate,  Couchbase

Page 2: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

©2014  Couchbase  Inc.

Schedule

2

Sync Gateway in-depth 1-1:30pm

Hands-on, Part 2: Replications 1:30-2pm

Data orchestration with Sync Gateway 2-2:30pm

Break 2:30-3pm

Hands-on, Part 3: Data orchestration 3-4pm

Page 3: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

Demo  Sync  Gateway

Page 4: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

Demo  Couchbase  Server

Page 5: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

vs.

Sync Cache

Page 6: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

Sync

Page 7: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

©2014  Couchbase  Inc.

Sync

Push    →  Pull        ←

7

Page 8: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

©2014  Couchbase  Inc.

Sync

Push    →  Couchbase  Sync  Gateway  Pull        ←  Couchbase  Sync  Gateway

8

Page 9: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

©2014  Couchbase  Inc.

Sync

9

public class HomeActivity extends Activity{ private static final String SYNC_URL = "http://localhost:4984/todos/"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Replication pull = database.createPullReplication(SYNC_URL);

pull.start(); }}

Page 10: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

Replication  Algorithm

Page 11: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

©2014  Couchbase  Inc.

Sync

11

public class HomeActivity extends Activity{ private static final String SYNC_URL = "http://localhost:4984/todos/"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Authenticator authenticator = AuthenticatorFactory.createFacebookAuthenticator(token); Replication pull = database.createPullReplication(SYNC_URL); pull.setAuthenticator(authenticator);

pull.start(); }}

Page 12: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

©2014  Couchbase  Inc.

Replications

12

Page 13: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

Step  8

Page 14: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

©2015  Couchbase  Inc. ‹#›

Step  8:  Replication  without  authentication

▪ push/pull  replications  

▪ in  continuous  mode

Page 15: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

©2014  Couchbase  Inc.

Sync

15

public class HomeActivity extends Activity{ private static final String SYNC_URL = "http://10.10.106.24:4984/todos/"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

Replication pull = database.createPullReplication(SYNC_URL); pull.setContinuous(true); pull.start(); }}

Page 16: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

Step  9

Page 17: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

©2015  Couchbase  Inc. ‹#›

Sync  Gateway  Basic  Authentication

▪ create  a  user:  POST  request  @  http://10.10.106.24:8080/signup  

▪ use  those  credentials  to  replicate  as  an  existing  user

Page 18: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

©2014  Couchbase  Inc.

Sync

18

public class HomeActivity extends Activity{ private static final String SYNC_URL = "http://10.10.106.24:4984/todos/"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

Replication pull = database.createPullReplication(SYNC_URL);pull.setContinuous(true);

pull.start(); }}

Page 19: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

©2014  Couchbase  Inc.

Sync

19

public class HomeActivity extends Activity{ private static final String SYNC_URL = "http://10.10.106.24:4984/todos/"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

Authenticator authenticator = AuthenticatorFactory.createBasicAuthenticator(name, password);Replication pull = database.createPullReplication(SYNC_URL);pull.setContinuous(true);

pull.start(); }}

Page 20: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

©2014  Couchbase  Inc.

Sync

20

public class HomeActivity extends Activity{ private static final String SYNC_URL = "http://10.10.106.24:4984/todos/"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

Authenticator authenticator = AuthenticatorFactory.createBasicAuthenticator(name, password);Replication pull = database.createPullReplication(SYNC_URL);pull.setContinuous(true); pull.setAuthenticator(authenticator);

pull.start(); }}

Page 21: Mobile workshop: Sync Gateway In-Depth: Couchbase Connect 2015

Midpoint  code:  git  fetch  git  checkout  workshop/midpoint