SlideShare una empresa de Scribd logo
1 de 65
Data Sync on iOS with
Couchbase Mobile
(Or, building better UX / Apps with distributed
databases and data synchronisation techniques)
http://ti.eng.br @thiago_sjc
Thiago Faria Alencar
February 17, 2016HERE Maps @ Berlin
What do you mean with User Experience anyway ?
Combination of technology to delivery the best user experience.
That’s why people switch / opt to services: think about
Blacklane, to Immobile scout, Soundcloud.. What can you offer
at the end of the day? Is it the best possible?
-Blacklane :)
-Amazon
-Airbnb
-Facebook
-Spotify
-Etc
Don’t “own" things, but redefine how user experience
music, transport,..
What do you mean with User Experience anyway ?
A little (real life) story
The coffee sales man
in the middle of nowhere
Back in 2007..
Let’s go back in time
< 1935 2007
Instant coffee for internal
Brazilian market.. let’s build
a system for sales …
Product’s website at:
www.cafesaojose.com.br
A website & mini ERP
A website & mini ERP
Basic LAMP Setup
(Linux + Apache + Mysql + Php)
Good old times.. right?
Using the system
Pedralva - Minas Gerais
Network coverage (as of today)
Oops, no connection? all data in the server miles away..
Back to 2016… (last weekend)
same old problems….
Transit routes (online-only
feature)
Clear found/searched route, hop in the train
Ups, inside subway now..
1 min later.. hm.. couldn’t we show the past/found route?
Other examples
Spotify - offline advertising!
‘Hobby' projects (telemetry)
IoT
Even the most ‘connected' applications will
experience network issues from time to time -> make
them operate offline as much as possible
Network coverage getting better …
but as of today still far from ideal..
A data locality/expiration issue
Can we do better?
hell yes.
Recognise the problem..
“Git-like” for databases?
“A distributed database is a database in which portions of
the database are stored on multiple computers within a
network.”
“Users have access to the portion of the database at their
location so that they can access the data relevant to their
tasks without interfering with the work of others.”
Turns out, a similar set of features needed on of distributed
databases (computer clusters) is desired to have at the end
nodes (mobile devices) > Same fundamental design decisions.
Analysing DB designs
Document / NoSql databases vs. relational databases
scalability / flexibility
CAP Theorem : set of basic requirements that
describe any distributed system (not just
storage/database systems).
Consistency - All the servers in the system will have the same
data so anyone using the system will get the same copy
regardless of which server answers their request.
CAP Theorem
Availability - The system will always respond to a request
(even if it's not the latest data or consistent across the system or
just a message saying the system isn't working).
CAP Theorem
Partition Tolerance - The system continues to operate as
a whole even if individual servers fail or can't be reached.
Document / NoSql databases vs. relational databases
Document / NoSql databases vs. relational databases
RDMS are more or less ‘all or nothing’, transaction-based, atomic
operations oriented.
Distributed databases relaxes this ‘atomic' requirement in order to provide
better scalability. It turns out this feature is useful for offline mobile apps as
well as we’ll see when compared to relation traditional databases.
Document / NoSql databases vs. relational databases
‘NoSQL databases' improves scaling by relaxing
consistency in favor of availability and partition tolerance.
A bit or market research..
Find the right tool to do the job
Intro to Couchbase
• Open source
• Cross-platform (really)
• Open protocols
• Backed by company, but small ‘lock-in’
• Easy to get started
• Small foot-print on client
• Built-in sync handling
• No ‘migration-hell’ (JSON docs)
How to solve the data sync problem?
Database per-user doesn’t scale
Instead, share a single database
Compare this to a “repository” in git: each subset of data
would be like a “repo”.. not all users will have access to all
data (e.g. ACL with gitolite)
The ‘traditional' way of exchanging data..
Encapsulate all of it in a SSL connection and everything will
be fine (that is, while your connection works).
What is happening here?
Notice how in the request – response model, data is “routed” by the different
API end-points: URI path will trigger a specific request handler in the server.
How such problems are solved during sync?
• Authentication
• Authorization
• Data validation / routing
How such problems are solved during sync?
• Data routing:
When another user connects to the same backend, we want only the
documents belonging to him to be synchronised. The term used for this in
Couchbase Mobile is data replication.
How such issues are resolved during sync?
That’s when Couchbase data orchestration features kicks in:
Not to depend on an active connection, what each data represents and
the respective routing are described in the document’s content itself.
-Optimal solution sits neither at one or the other end of the spectrum -
normally you need a mix of things : so normal http reqs still useful!
How such issues are resolved during sync?
For iOS, called
‘Couchbase Lite’
-Available for many other
platforms.
-Advantages of being a
JSON database (no
migration hell)
-Sync gateway ‘like the git
merge'
Document: the primary entity stored in a database
is called a document instead of a “row” or “record”.
Views: ‘denormalised tables/indexes ’; dynamically
generated from JSON objects
Queries: the action of looking up results from a
view’s index
Some terminology in Couchbase Lite land..
(Roots in Map/Reduce programming model)
1
2
3
4
5
6
CBLManager *manager = [CBLManager sharedInstance];
NSError *error;
CBLDatabase* _database = [manager databaseNamed: @"conektapp_db" error: &error];
if (error) { NSLog(@"error getting database %@",error); }
NSDictionary* properties = @{@"user_id": @"joe",
@"type": @"contactInfo",
@"contactData": @“+49610234192"};
CBLDocument* document = [database documentWithID:
[NSString stringWithFormat: @"%@:%@", type, user_id]];
NSError* error;
if (![document putProperties: properties error: &error]) {
[self handleError: error];
}
Saving an object in Couchbase Lite
( For questions on this see more detailed articles at http://ti.eng.br )
1
2
3
4
5
6
- (CBLQuery*) queryContactInfoFromUsername:(NSString*) user
{
//1- createView
CBLView * contactInfoView = [self.database viewNamed:
@"contactDataByUsername"];
[contactInfoView setMapBlock: MAPBLOCK({
if ([doc[@"type"] isEqualToString: @"contactInfo"]) {
if (doc[@"user_id"])
emit(doc[@"user_id"], doc[@"contactData"]);
}
}) version: @"2"];
}
Retrieve an object in Couchbase Lite
1
2
3
4
5
6
- (CBLQuery*) queryContactInfoFromUsername:(NSString*) user
{
//1- createView
CBLView * contactInfoView = [self.database viewNamed:
@"contactDataByUsername"];
[contactInfoView setMapBlock: MAPBLOCK({
if ([doc[@"type"] isEqualToString: @"contactInfo"]) {
if (doc[@"user_id"])
emit(doc[@"user_id"], doc[@"contactData"]);
}
}) version: @"2"];
//2 - make the query
CBLQuery* query = [contactInfoView createQuery];
NSLog(@"Querying username: %@", user);
query.startKey = user;
query.endKey = user;
return query;
}
Retrieve an object in Couchbase Lite
1
2
3
4
5
6
- (CBLQuery*) queryContactInfoFromUsername:(NSString*) user
{
//1- createView
CBLView * contactInfoView = [self.database viewNamed:
@"contactDataByUsername"];
[contactInfoView setMapBlock: MAPBLOCK({
if ([doc[@"type"] isEqualToString: @"contactInfo"]) {
if (doc[@"user_id"])
emit(doc[@"user_id"], doc[@"contactData"]);
}
}) version: @"2"];
//2 - make the query
CBLQuery* query = [contactInfoView createQuery];
NSLog(@"Querying username: %@", user);
query.startKey = user;
query.endKey = user;
return query;
}
//run, enumerate
CBLQuery *contactQuery = [myObject queryContactInfoFromUsername:
@"thiago"];
CBLQueryEnumerator* result = [contactQuery run: &error];
for(CBLQueryRow* row in result)
{
NSLog(@"Found document: %@", row.document);
}
1
2
3
4
5
6
NSURL* url = [NSURL URLWithString:
@“http://yourapp.com/sync_gateway/"];
CBLReplication *push = [database createPushReplication: url];
CBLReplication *pull = [database createPullReplication: url];
push.continuous = pull.continuous = YES;
[pull setCookieNamed:@"SyncGatewaySession" withValue:sessionValue
path:nil expirationDate:nil secure:NO];
[push setCookieNamed:@"SyncGatewaySession" withValue:sessionValue
path:nil expirationDate:nil secure:NO];
NSLog(@"startSync");
[pull start];
[push start];
Getting replication running.. client side
The server-side
Sync gateway configuration
Located in the sync gateway, the 'sync function' is responsible for
document authorisation, validation, routing.
The server-side
Sync gateway configuration
1
2
3
4
5
6
7
8
9
10
11
12
{
"interface":":4984",
"adminInterface":":4985",
"log":["REST"],
"databases":{
"sync_gateway":{
"server":"http://localhost:8091",
"bucket":"app_bucket",
"sync":`function(doc) {channel(doc.channels);}`
}
}
}
sync function, not much defined for now.. will
grow according to your application’s needs
When the sync function kicks in?
More on the sync function..
function(doc, oldDoc)
{
requireUser(oldDoc.owner);
channel(doc.channel);
access(doc.members, doc.roomID);
}
Validation
More on the sync function..
function(doc, oldDoc)
{
requireUser(oldDoc.owner);
channel(doc.channel);
access(doc.members, doc.roomID);
}
Routing
More on the sync function..
function(doc, oldDoc)
{
requireUser(oldDoc.owner);
channel(doc.channel);
access(doc.members, doc.roomID);
}
Access
Control
About the concept of “Channels”
App server tags Documents on entry; Docs are indexed by channel for
replication.
Summary
Data scalability: Replicate only docs relevante to
respective user.
Access Control: Replicate only documents visible to
this user
Data Validation: Replicate only documents that
contains valid information
Syncing events.. (change notifications)
Web Bonus
Web
Others
Bonus
Web
Others
Bonus
Thank you :)
Finally we have a way to automate data
synchronisation!! Please use it! :)
And let’s shift our designs / apps away from the old "LAMP style”
into something that actually works in real life scenarios also when
'on the go'..
Q&A
One more slide to show how a more ‘elaborated'
sync function may look like..
function (doc, oldDoc) {
if (doc._deleted) {
// Only editors with write access can delete documents:
requireRole("role:editor");
requireUser(oldDoc.writers);
// Skip other validation because a deletion has no other properties:
return;
}
// Required properties:
if (!doc.title || !doc.creator || !doc.channels || !doc.writers) {
throw({forbidden: "Missing required properties"});
} else if (doc.writers.length == 0) {
throw({forbidden: "No writers"});
}
if (oldDoc == null) {
// Only editors can create documents:
requireRole("role:editor");
// The 'creator' property must match the user creating the document:
requireUser(doc.creator)
} else {
// Only users in the existing doc's writers list can change a document:
requireUser(oldDoc.writers);
// The "creator" property is immutable:
if (doc.creator != oldDoc.creator) {
throw({forbidden: "Can't change creator"});
}
}
// Finally, assign the document to the channels in the list:
channel(doc.channels);
}

Más contenido relacionado

La actualidad más candente

MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB
 
CouchDB : More Couch
CouchDB : More CouchCouchDB : More Couch
CouchDB : More Couchdelagoya
 
MongoDB .local Paris 2020: Les bonnes pratiques pour travailler avec les donn...
MongoDB .local Paris 2020: Les bonnes pratiques pour travailler avec les donn...MongoDB .local Paris 2020: Les bonnes pratiques pour travailler avec les donn...
MongoDB .local Paris 2020: Les bonnes pratiques pour travailler avec les donn...MongoDB
 
Android writing and reading from firebase
Android writing and reading from firebaseAndroid writing and reading from firebase
Android writing and reading from firebaseOsahon Gino Ediagbonya
 
Extensible Database APIs and their role in Software Architecture
Extensible Database APIs and their role in Software ArchitectureExtensible Database APIs and their role in Software Architecture
Extensible Database APIs and their role in Software ArchitectureMax Neunhöffer
 
Hands-On: Managing Slowly Changing Dimensions Using TD Workflow
Hands-On: Managing Slowly Changing Dimensions Using TD WorkflowHands-On: Managing Slowly Changing Dimensions Using TD Workflow
Hands-On: Managing Slowly Changing Dimensions Using TD WorkflowTreasure Data, Inc.
 
MongoDB ClickStream and Visualization
MongoDB ClickStream and VisualizationMongoDB ClickStream and Visualization
MongoDB ClickStream and VisualizationCameron Sim
 
CData Data Today: A Developer's Dilemma
CData Data Today: A Developer's DilemmaCData Data Today: A Developer's Dilemma
CData Data Today: A Developer's DilemmaJerod Johnson
 
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers ProgramSession 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers ProgramFIWARE
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBNodeXperts
 
A Programming Layer for the Internet from Kynetx Impact 2010
A Programming Layer for the Internet from Kynetx Impact 2010A Programming Layer for the Internet from Kynetx Impact 2010
A Programming Layer for the Internet from Kynetx Impact 2010Phil Windley
 
OUG Scotland 2014 - NoSQL and MySQL - The best of both worlds
OUG Scotland 2014 - NoSQL and MySQL - The best of both worldsOUG Scotland 2014 - NoSQL and MySQL - The best of both worlds
OUG Scotland 2014 - NoSQL and MySQL - The best of both worldsAndrew Morgan
 
Grokking Engineering - Data Analytics Infrastructure at Viki - Huy Nguyen
Grokking Engineering - Data Analytics Infrastructure at Viki - Huy NguyenGrokking Engineering - Data Analytics Infrastructure at Viki - Huy Nguyen
Grokking Engineering - Data Analytics Infrastructure at Viki - Huy NguyenHuy Nguyen
 

La actualidad más candente (20)

MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
 
CouchDB : More Couch
CouchDB : More CouchCouchDB : More Couch
CouchDB : More Couch
 
MongoDB .local Paris 2020: Les bonnes pratiques pour travailler avec les donn...
MongoDB .local Paris 2020: Les bonnes pratiques pour travailler avec les donn...MongoDB .local Paris 2020: Les bonnes pratiques pour travailler avec les donn...
MongoDB .local Paris 2020: Les bonnes pratiques pour travailler avec les donn...
 
Android writing and reading from firebase
Android writing and reading from firebaseAndroid writing and reading from firebase
Android writing and reading from firebase
 
Extensible Database APIs and their role in Software Architecture
Extensible Database APIs and their role in Software ArchitectureExtensible Database APIs and their role in Software Architecture
Extensible Database APIs and their role in Software Architecture
 
Hands-On: Managing Slowly Changing Dimensions Using TD Workflow
Hands-On: Managing Slowly Changing Dimensions Using TD WorkflowHands-On: Managing Slowly Changing Dimensions Using TD Workflow
Hands-On: Managing Slowly Changing Dimensions Using TD Workflow
 
MongoDB ClickStream and Visualization
MongoDB ClickStream and VisualizationMongoDB ClickStream and Visualization
MongoDB ClickStream and Visualization
 
CData Data Today: A Developer's Dilemma
CData Data Today: A Developer's DilemmaCData Data Today: A Developer's Dilemma
CData Data Today: A Developer's Dilemma
 
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers ProgramSession 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
 
MeteorJS Introduction
MeteorJS IntroductionMeteorJS Introduction
MeteorJS Introduction
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Couch db
Couch dbCouch db
Couch db
 
On no sql.partiii
On no sql.partiiiOn no sql.partiii
On no sql.partiii
 
A Programming Layer for the Internet from Kynetx Impact 2010
A Programming Layer for the Internet from Kynetx Impact 2010A Programming Layer for the Internet from Kynetx Impact 2010
A Programming Layer for the Internet from Kynetx Impact 2010
 
MongoDB and Schema Design
MongoDB and Schema DesignMongoDB and Schema Design
MongoDB and Schema Design
 
Hands On: Javascript SDK
Hands On: Javascript SDKHands On: Javascript SDK
Hands On: Javascript SDK
 
OUG Scotland 2014 - NoSQL and MySQL - The best of both worlds
OUG Scotland 2014 - NoSQL and MySQL - The best of both worldsOUG Scotland 2014 - NoSQL and MySQL - The best of both worlds
OUG Scotland 2014 - NoSQL and MySQL - The best of both worlds
 
Grokking Engineering - Data Analytics Infrastructure at Viki - Huy Nguyen
Grokking Engineering - Data Analytics Infrastructure at Viki - Huy NguyenGrokking Engineering - Data Analytics Infrastructure at Viki - Huy Nguyen
Grokking Engineering - Data Analytics Infrastructure at Viki - Huy Nguyen
 

Destacado

EDDI 2011 - A Generic Multilevel Approach for Designing Domain Ontologies Bas...
EDDI 2011 - A Generic Multilevel Approach for Designing Domain Ontologies Bas...EDDI 2011 - A Generic Multilevel Approach for Designing Domain Ontologies Bas...
EDDI 2011 - A Generic Multilevel Approach for Designing Domain Ontologies Bas...Dr.-Ing. Thomas Hartmann
 
Sync It Up
Sync It UpSync It Up
Sync It Upsvoisen
 
Integrating a Domain Ontology Development Environment and an Ontology Search ...
Integrating a Domain Ontology Development Environment and an Ontology Search ...Integrating a Domain Ontology Development Environment and an Ontology Search ...
Integrating a Domain Ontology Development Environment and an Ontology Search ...Takeshi Morita
 
Distributed RDBMS: Data Distribution Policy: Part 1 - What is a Data Distribu...
Distributed RDBMS: Data Distribution Policy: Part 1 - What is a Data Distribu...Distributed RDBMS: Data Distribution Policy: Part 1 - What is a Data Distribu...
Distributed RDBMS: Data Distribution Policy: Part 1 - What is a Data Distribu...ScaleBase
 
SQLite Techniques
SQLite TechniquesSQLite Techniques
SQLite Techniquesjoaopmaia
 
MySQL Group Replication
MySQL Group ReplicationMySQL Group Replication
MySQL Group ReplicationUlf Wendel
 

Destacado (7)

EDDI 2011 - A Generic Multilevel Approach for Designing Domain Ontologies Bas...
EDDI 2011 - A Generic Multilevel Approach for Designing Domain Ontologies Bas...EDDI 2011 - A Generic Multilevel Approach for Designing Domain Ontologies Bas...
EDDI 2011 - A Generic Multilevel Approach for Designing Domain Ontologies Bas...
 
C SQLite usage
C SQLite usageC SQLite usage
C SQLite usage
 
Sync It Up
Sync It UpSync It Up
Sync It Up
 
Integrating a Domain Ontology Development Environment and an Ontology Search ...
Integrating a Domain Ontology Development Environment and an Ontology Search ...Integrating a Domain Ontology Development Environment and an Ontology Search ...
Integrating a Domain Ontology Development Environment and an Ontology Search ...
 
Distributed RDBMS: Data Distribution Policy: Part 1 - What is a Data Distribu...
Distributed RDBMS: Data Distribution Policy: Part 1 - What is a Data Distribu...Distributed RDBMS: Data Distribution Policy: Part 1 - What is a Data Distribu...
Distributed RDBMS: Data Distribution Policy: Part 1 - What is a Data Distribu...
 
SQLite Techniques
SQLite TechniquesSQLite Techniques
SQLite Techniques
 
MySQL Group Replication
MySQL Group ReplicationMySQL Group Replication
MySQL Group Replication
 

Similar a Data sync on iOS with Couchbase Mobile

Реляционные или нереляционные (Josh Berkus)
Реляционные или нереляционные (Josh Berkus)Реляционные или нереляционные (Josh Berkus)
Реляционные или нереляционные (Josh Berkus)Ontico
 
A sane approach to microservices
A sane approach to microservicesA sane approach to microservices
A sane approach to microservicesToby Matejovsky
 
Big Data - An Overview
Big Data -  An OverviewBig Data -  An Overview
Big Data - An OverviewArvind Kalyan
 
Document Based Data Modeling Technique
Document Based Data Modeling TechniqueDocument Based Data Modeling Technique
Document Based Data Modeling TechniqueCarmen Sanborn
 
PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#Michael Heron
 
Document Databases & RavenDB
Document Databases & RavenDBDocument Databases & RavenDB
Document Databases & RavenDBBrian Ritchie
 
Is multi-model the future of NoSQL?
Is multi-model the future of NoSQL?Is multi-model the future of NoSQL?
Is multi-model the future of NoSQL?Max Neunhöffer
 
History of NoSQL and Azure Documentdb feature set
History of NoSQL and Azure Documentdb feature setHistory of NoSQL and Azure Documentdb feature set
History of NoSQL and Azure Documentdb feature setSoner Altin
 
Using Cassandra with your Web Application
Using Cassandra with your Web ApplicationUsing Cassandra with your Web Application
Using Cassandra with your Web Applicationsupertom
 
Experimenting With Big Data
Experimenting With Big DataExperimenting With Big Data
Experimenting With Big DataNick Boucart
 
TCS_DATA_ANALYSIS_REPORT_ADITYA
TCS_DATA_ANALYSIS_REPORT_ADITYATCS_DATA_ANALYSIS_REPORT_ADITYA
TCS_DATA_ANALYSIS_REPORT_ADITYAAditya Srinivasan
 
Big Data - Need of Converged Data Platform
Big Data - Need of Converged Data PlatformBig Data - Need of Converged Data Platform
Big Data - Need of Converged Data PlatformGeekNightHyderabad
 
Bigdata processing with Spark
Bigdata processing with SparkBigdata processing with Spark
Bigdata processing with SparkArjen de Vries
 
Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...
Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...
Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...confluent
 

Similar a Data sync on iOS with Couchbase Mobile (20)

Реляционные или нереляционные (Josh Berkus)
Реляционные или нереляционные (Josh Berkus)Реляционные или нереляционные (Josh Berkus)
Реляционные или нереляционные (Josh Berkus)
 
A sane approach to microservices
A sane approach to microservicesA sane approach to microservices
A sane approach to microservices
 
Big Data - An Overview
Big Data -  An OverviewBig Data -  An Overview
Big Data - An Overview
 
Document Based Data Modeling Technique
Document Based Data Modeling TechniqueDocument Based Data Modeling Technique
Document Based Data Modeling Technique
 
PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#
 
CouchDB
CouchDBCouchDB
CouchDB
 
Oslo bekk2014
Oslo bekk2014Oslo bekk2014
Oslo bekk2014
 
Document Databases & RavenDB
Document Databases & RavenDBDocument Databases & RavenDB
Document Databases & RavenDB
 
Is multi-model the future of NoSQL?
Is multi-model the future of NoSQL?Is multi-model the future of NoSQL?
Is multi-model the future of NoSQL?
 
Elasticsearch
ElasticsearchElasticsearch
Elasticsearch
 
DataHub
DataHubDataHub
DataHub
 
NOSQL
NOSQLNOSQL
NOSQL
 
History of NoSQL and Azure Documentdb feature set
History of NoSQL and Azure Documentdb feature setHistory of NoSQL and Azure Documentdb feature set
History of NoSQL and Azure Documentdb feature set
 
Oslo baksia2014
Oslo baksia2014Oslo baksia2014
Oslo baksia2014
 
Using Cassandra with your Web Application
Using Cassandra with your Web ApplicationUsing Cassandra with your Web Application
Using Cassandra with your Web Application
 
Experimenting With Big Data
Experimenting With Big DataExperimenting With Big Data
Experimenting With Big Data
 
TCS_DATA_ANALYSIS_REPORT_ADITYA
TCS_DATA_ANALYSIS_REPORT_ADITYATCS_DATA_ANALYSIS_REPORT_ADITYA
TCS_DATA_ANALYSIS_REPORT_ADITYA
 
Big Data - Need of Converged Data Platform
Big Data - Need of Converged Data PlatformBig Data - Need of Converged Data Platform
Big Data - Need of Converged Data Platform
 
Bigdata processing with Spark
Bigdata processing with SparkBigdata processing with Spark
Bigdata processing with Spark
 
Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...
Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...
Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...
 

Último

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 

Último (20)

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 

Data sync on iOS with Couchbase Mobile

  • 1. Data Sync on iOS with Couchbase Mobile (Or, building better UX / Apps with distributed databases and data synchronisation techniques) http://ti.eng.br @thiago_sjc Thiago Faria Alencar February 17, 2016HERE Maps @ Berlin
  • 2. What do you mean with User Experience anyway ? Combination of technology to delivery the best user experience. That’s why people switch / opt to services: think about Blacklane, to Immobile scout, Soundcloud.. What can you offer at the end of the day? Is it the best possible?
  • 3. -Blacklane :) -Amazon -Airbnb -Facebook -Spotify -Etc Don’t “own" things, but redefine how user experience music, transport,.. What do you mean with User Experience anyway ?
  • 4. A little (real life) story
  • 5. The coffee sales man in the middle of nowhere Back in 2007..
  • 6. Let’s go back in time < 1935 2007 Instant coffee for internal Brazilian market.. let’s build a system for sales … Product’s website at: www.cafesaojose.com.br
  • 7. A website & mini ERP
  • 8. A website & mini ERP
  • 9. Basic LAMP Setup (Linux + Apache + Mysql + Php) Good old times.. right?
  • 10. Using the system Pedralva - Minas Gerais
  • 11. Network coverage (as of today) Oops, no connection? all data in the server miles away..
  • 12. Back to 2016… (last weekend) same old problems….
  • 14. Clear found/searched route, hop in the train
  • 15. Ups, inside subway now.. 1 min later.. hm.. couldn’t we show the past/found route?
  • 16. Other examples Spotify - offline advertising! ‘Hobby' projects (telemetry) IoT Even the most ‘connected' applications will experience network issues from time to time -> make them operate offline as much as possible
  • 17. Network coverage getting better … but as of today still far from ideal..
  • 19. Can we do better?
  • 23. “A distributed database is a database in which portions of the database are stored on multiple computers within a network.”
  • 24. “Users have access to the portion of the database at their location so that they can access the data relevant to their tasks without interfering with the work of others.” Turns out, a similar set of features needed on of distributed databases (computer clusters) is desired to have at the end nodes (mobile devices) > Same fundamental design decisions.
  • 25. Analysing DB designs Document / NoSql databases vs. relational databases scalability / flexibility
  • 26. CAP Theorem : set of basic requirements that describe any distributed system (not just storage/database systems). Consistency - All the servers in the system will have the same data so anyone using the system will get the same copy regardless of which server answers their request.
  • 27. CAP Theorem Availability - The system will always respond to a request (even if it's not the latest data or consistent across the system or just a message saying the system isn't working).
  • 28. CAP Theorem Partition Tolerance - The system continues to operate as a whole even if individual servers fail or can't be reached.
  • 29. Document / NoSql databases vs. relational databases
  • 30. Document / NoSql databases vs. relational databases RDMS are more or less ‘all or nothing’, transaction-based, atomic operations oriented. Distributed databases relaxes this ‘atomic' requirement in order to provide better scalability. It turns out this feature is useful for offline mobile apps as well as we’ll see when compared to relation traditional databases.
  • 31. Document / NoSql databases vs. relational databases ‘NoSQL databases' improves scaling by relaxing consistency in favor of availability and partition tolerance.
  • 32. A bit or market research.. Find the right tool to do the job
  • 33. Intro to Couchbase • Open source • Cross-platform (really) • Open protocols • Backed by company, but small ‘lock-in’ • Easy to get started • Small foot-print on client • Built-in sync handling • No ‘migration-hell’ (JSON docs)
  • 34. How to solve the data sync problem?
  • 36. Instead, share a single database Compare this to a “repository” in git: each subset of data would be like a “repo”.. not all users will have access to all data (e.g. ACL with gitolite)
  • 37. The ‘traditional' way of exchanging data.. Encapsulate all of it in a SSL connection and everything will be fine (that is, while your connection works).
  • 38. What is happening here? Notice how in the request – response model, data is “routed” by the different API end-points: URI path will trigger a specific request handler in the server.
  • 39. How such problems are solved during sync? • Authentication • Authorization • Data validation / routing
  • 40. How such problems are solved during sync? • Data routing: When another user connects to the same backend, we want only the documents belonging to him to be synchronised. The term used for this in Couchbase Mobile is data replication.
  • 41. How such issues are resolved during sync? That’s when Couchbase data orchestration features kicks in: Not to depend on an active connection, what each data represents and the respective routing are described in the document’s content itself. -Optimal solution sits neither at one or the other end of the spectrum - normally you need a mix of things : so normal http reqs still useful!
  • 42. How such issues are resolved during sync?
  • 43. For iOS, called ‘Couchbase Lite’ -Available for many other platforms. -Advantages of being a JSON database (no migration hell) -Sync gateway ‘like the git merge'
  • 44. Document: the primary entity stored in a database is called a document instead of a “row” or “record”. Views: ‘denormalised tables/indexes ’; dynamically generated from JSON objects Queries: the action of looking up results from a view’s index Some terminology in Couchbase Lite land.. (Roots in Map/Reduce programming model)
  • 45. 1 2 3 4 5 6 CBLManager *manager = [CBLManager sharedInstance]; NSError *error; CBLDatabase* _database = [manager databaseNamed: @"conektapp_db" error: &error]; if (error) { NSLog(@"error getting database %@",error); } NSDictionary* properties = @{@"user_id": @"joe", @"type": @"contactInfo", @"contactData": @“+49610234192"}; CBLDocument* document = [database documentWithID: [NSString stringWithFormat: @"%@:%@", type, user_id]]; NSError* error; if (![document putProperties: properties error: &error]) { [self handleError: error]; } Saving an object in Couchbase Lite ( For questions on this see more detailed articles at http://ti.eng.br )
  • 46. 1 2 3 4 5 6 - (CBLQuery*) queryContactInfoFromUsername:(NSString*) user { //1- createView CBLView * contactInfoView = [self.database viewNamed: @"contactDataByUsername"]; [contactInfoView setMapBlock: MAPBLOCK({ if ([doc[@"type"] isEqualToString: @"contactInfo"]) { if (doc[@"user_id"]) emit(doc[@"user_id"], doc[@"contactData"]); } }) version: @"2"]; } Retrieve an object in Couchbase Lite
  • 47. 1 2 3 4 5 6 - (CBLQuery*) queryContactInfoFromUsername:(NSString*) user { //1- createView CBLView * contactInfoView = [self.database viewNamed: @"contactDataByUsername"]; [contactInfoView setMapBlock: MAPBLOCK({ if ([doc[@"type"] isEqualToString: @"contactInfo"]) { if (doc[@"user_id"]) emit(doc[@"user_id"], doc[@"contactData"]); } }) version: @"2"]; //2 - make the query CBLQuery* query = [contactInfoView createQuery]; NSLog(@"Querying username: %@", user); query.startKey = user; query.endKey = user; return query; } Retrieve an object in Couchbase Lite
  • 48. 1 2 3 4 5 6 - (CBLQuery*) queryContactInfoFromUsername:(NSString*) user { //1- createView CBLView * contactInfoView = [self.database viewNamed: @"contactDataByUsername"]; [contactInfoView setMapBlock: MAPBLOCK({ if ([doc[@"type"] isEqualToString: @"contactInfo"]) { if (doc[@"user_id"]) emit(doc[@"user_id"], doc[@"contactData"]); } }) version: @"2"]; //2 - make the query CBLQuery* query = [contactInfoView createQuery]; NSLog(@"Querying username: %@", user); query.startKey = user; query.endKey = user; return query; } //run, enumerate CBLQuery *contactQuery = [myObject queryContactInfoFromUsername: @"thiago"]; CBLQueryEnumerator* result = [contactQuery run: &error]; for(CBLQueryRow* row in result) { NSLog(@"Found document: %@", row.document); }
  • 49. 1 2 3 4 5 6 NSURL* url = [NSURL URLWithString: @“http://yourapp.com/sync_gateway/"]; CBLReplication *push = [database createPushReplication: url]; CBLReplication *pull = [database createPullReplication: url]; push.continuous = pull.continuous = YES; [pull setCookieNamed:@"SyncGatewaySession" withValue:sessionValue path:nil expirationDate:nil secure:NO]; [push setCookieNamed:@"SyncGatewaySession" withValue:sessionValue path:nil expirationDate:nil secure:NO]; NSLog(@"startSync"); [pull start]; [push start]; Getting replication running.. client side
  • 50. The server-side Sync gateway configuration Located in the sync gateway, the 'sync function' is responsible for document authorisation, validation, routing.
  • 51. The server-side Sync gateway configuration 1 2 3 4 5 6 7 8 9 10 11 12 { "interface":":4984", "adminInterface":":4985", "log":["REST"], "databases":{ "sync_gateway":{ "server":"http://localhost:8091", "bucket":"app_bucket", "sync":`function(doc) {channel(doc.channels);}` } } } sync function, not much defined for now.. will grow according to your application’s needs
  • 52. When the sync function kicks in?
  • 53. More on the sync function.. function(doc, oldDoc) { requireUser(oldDoc.owner); channel(doc.channel); access(doc.members, doc.roomID); } Validation
  • 54. More on the sync function.. function(doc, oldDoc) { requireUser(oldDoc.owner); channel(doc.channel); access(doc.members, doc.roomID); } Routing
  • 55. More on the sync function.. function(doc, oldDoc) { requireUser(oldDoc.owner); channel(doc.channel); access(doc.members, doc.roomID); } Access Control
  • 56. About the concept of “Channels” App server tags Documents on entry; Docs are indexed by channel for replication.
  • 57. Summary Data scalability: Replicate only docs relevante to respective user. Access Control: Replicate only documents visible to this user Data Validation: Replicate only documents that contains valid information
  • 58. Syncing events.. (change notifications)
  • 62. Thank you :) Finally we have a way to automate data synchronisation!! Please use it! :) And let’s shift our designs / apps away from the old "LAMP style” into something that actually works in real life scenarios also when 'on the go'..
  • 63. Q&A
  • 64. One more slide to show how a more ‘elaborated' sync function may look like..
  • 65. function (doc, oldDoc) { if (doc._deleted) { // Only editors with write access can delete documents: requireRole("role:editor"); requireUser(oldDoc.writers); // Skip other validation because a deletion has no other properties: return; } // Required properties: if (!doc.title || !doc.creator || !doc.channels || !doc.writers) { throw({forbidden: "Missing required properties"}); } else if (doc.writers.length == 0) { throw({forbidden: "No writers"}); } if (oldDoc == null) { // Only editors can create documents: requireRole("role:editor"); // The 'creator' property must match the user creating the document: requireUser(doc.creator) } else { // Only users in the existing doc's writers list can change a document: requireUser(oldDoc.writers); // The "creator" property is immutable: if (doc.creator != oldDoc.creator) { throw({forbidden: "Can't change creator"}); } } // Finally, assign the document to the channels in the list: channel(doc.channels); }

Notas del editor

  1. (more details can be found in my blog, Mobile Couchbase section) -Thanks to Event Host, Organizers, audience, and Jens (couchbase) -how many heard of… couchbase , distributed database?
  2. -'Root thing' Combination of technology to delivery an user experience. That’s why people switch services: think about blacklane, to immobile scout, to soundcloud. What can you offer at the end of the day? Is it the best possible?
  3. -'Root thing' Combination of technology to delivery an user experience. That’s why people switch services: think about blacklane, to immobile scout, to soundcloud. What can you offer at the end of the day? Is it the best possible?
  4. Story behind it (why - people still struggle with this problem, motivation, belief of making things better)
  5. -For years to come -Mind the ‘unconnected' connected applications
  6. -Data / database core to any application
  7. All about improving UX > better design ideas lead to better systems (how) > transfer the idea to you. Mention Git analogy.
  8. Same set of problems of distributed databases in clusters. Same fundamental design decisions.
  9. Small introduction to Distributed Databases.
  10. CAP theorem : set of basic requirements that describe any distributed system (not just storage/database systems).
  11. It's theoretically impossible to have all 3 requirements met, so a combination of 2 must be chosen and this is usually the deciding factor in what technology is used.
  12. DD relaxes this requirement in order to provide better scalability. It turns out this feature is useful for offline mobile apps as well as we’ll see when compared to relation traditional databases. RDMS are more or less ‘all or nothing’, transaction-based, atomic operations oriented.
  13. DD relaxes this requirement in order to provide better scalability. It turns out this feature is useful for offline mobile apps as well as we’ll see when compared to relation traditional databases. RDMS are more or less ‘all or nothing’, transaction-based, atomic operations oriented.
  14. -Parse, -Firebase (google) -Cloudkit (?) not really.. what about the other platforms? -Encourage to Research yourself..
  15. Operate directly on local database. And ‘sync’ it, just like a git push/pull. Not limited to mobile devices (smartphones), but can be also used in embedded computers which eventually get disconnected but need to continue operating.
  16. Compare this to a “repository” in git.
  17. Encapsulate all of it in a SSL connection and everything will be fine (that is, while your connection works).
  18. -Authentication -Authorization -Data validation / routing : Notice how in the request – response model, data is “routed” by the different API end-points: URI path will trigger a specific request handler in the server.
  19. the term used for this in Couchbase Mobile is data replication. When another user connects to the same backend, we want only the documents belonging to him to be synchronised, and the term used for this is data routing.
  20. the term used for this in Couchbase Mobile is data replication. When another user connects to the same backend, we want only the documents belonging to him to be synchronised, and the term used for this is data routing.
  21. That’s when Couchbase data orchestration support kicks in. -not to depend on an active connection, what each data represents and the respective routing are described in the document’s content itself -Neither at one or the other end of the spectrum, normal reqs still useful! -Compare to git (how come we didn’t do it before?)
  22. That’s when Couchbase data orchestration support kicks in. -not to depend on an active connection, what each data represents and the respective routing are described in the document’s content itself -Neither at one or the other end of the spectrum, normal reqs still useful! -Compare to git (how come we didn’t do it before?)
  23. -Available for many other platforms. -Advantages of being a JSON database (no migration hell) -Sync gateway ‘like the git merge'
  24. (before going into details..) -a mention about N1QL Couchbase server
  25. Note the sync function: Responsible for document authorisation, validation, routing. We will implement / explain this in step 6, for now we left here the 'default' which does no verification.
  26. Note the sync function: Responsible for document authorisation, validation, routing. We will implement / explain this in step 6, for now we left here the 'default' which does no verification.
  27. App server tags Documents on entry; Docs are indexed by channel for replication.
  28. -And let’s shift our designs / apps away from the old "LAMP style"