falcor - software development conference web server application server ... building netflix with...
TRANSCRIPT
![Page 1: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/1.jpg)
Jafar Husain
@jhusain
One Model Everywhere
FALCOR
![Page 2: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/2.jpg)
Every user wants to believe that the
entire cloud is on their device.
![Page 3: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/3.jpg)
What if you could code that way?
![Page 4: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/4.jpg)
This is the story of how
eliminated 90% of the
networking code in our app.
![Page 5: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/5.jpg)
Jafar Husain
• Netflix’s Cross Team UI Tech Lead
• Architect of FALCOR
• Active Participant in TC-39, the JavaScript
standards committee
![Page 6: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/6.jpg)
2014321
![Page 7: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/7.jpg)
2010
Netflix had a RESTful API.
![Page 8: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/8.jpg)
is a browsing problem.
![Page 9: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/9.jpg)
http://www.netflix.com/genreLists
?rowOffset=0&rowSize=5&colOffset=5
&colSize=15&titleprops=name,boxshot
http://www.netflix.com/setRating
?titleId=5&view=movieDetailPage
RPC API
20101
Netflix’s RESTful API
http://www.netflix.com/genreList/12429
http://www.netflix.com/title/1601923
![Page 10: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/10.jpg)
http://www.netflix.com/genreLists
?rowOffset=0&rowSize=5&colOffset=5
&colSize=15&titleprops=name,boxshot
http://www.netflix.com/setRating
?titleId=5&view=movieDetailPage
RPC API
201 1
![Page 11: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/11.jpg)
Why move away from REST?
![Page 12: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/12.jpg)
Once the web was a place to get things.
![Page 13: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/13.jpg)
Today the web is a place to do things.
![Page 14: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/14.jpg)
Web ServerCDN Application Server
Web Servers serve large resources.
App Servers serve small resources.
![Page 15: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/15.jpg)
Fine-Grained Title Resource
http://netflix.com/titles/95632123
{
id: 2523,
name: “House of Cards”,
boxshot: “http://…/018-192-x50.png”,
rating: 5,
bookmark: 52119562,
director: “David Fincher”,
// a few more fields
}
![Page 16: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/16.jpg)
REST: Multiple Roundtrips
01: GET /genreLists
02: GET netflix.com/titles/956325
03: GET cdn01.netflix.com/072-192-x50.png
04: GET netflix.com/titles/992338
05: GET cdn03.netflix.com/018-192-x50.png
06: GET netflix.com/titles/912738
07: GET cdn09.netflix.com/651-70x50.png
…27: GET netflix.com/titles/561826
28: GET cdn23.netflix.com/018-70x50.png
![Page 17: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/17.jpg)
Client HTTP Cache
REST: Cache Coherence
Title DB
Issue Issue Issue
Issue Issue Issue
Issue Issue Issue
Issue Issue Issue
Issue Issue Issue
Personalized Recommendations
Personalize
d
Genre Lists
Issue Issue Issue
Issue Issue Issue
Issue Issue Issue
Issue Issue Issue
Title Title Title
Personalize
d
Genre Lists
![Page 18: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/18.jpg)
REST
• Cache Consistency
• Loose Coupling
• High Latency
• Large Message Sizes
![Page 19: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/19.jpg)
http://www.netflix.com/genreLists
?pageSize=10x15&titleprops=id,boxshot
http://www.netflix.com/setRating
?titleId=5&view=movieDetailPage
RPC API
201 1
![Page 20: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/20.jpg)
/genreList?pageSize=13x15 /search?text=house/genreList?pageSize=13x15 /search?text=netflix/titleDetails?id=342/titleDetails?id=342
Netflix RPC
![Page 21: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/21.jpg)
RPC: One Request per View
/titles/95632123
{id: 2523,name: “House of Cards”,boxshot: “http://…/018-192x50.png”,rating: 5,bookmark: 52119562,executiveProducer: “David Fincher”,director: “David Fincher”,description: “This Emmy-winning original
thriller series stars Golden Globe winner Kevin Spacey as ruthless, cunning Congressman Francis Underwood, who will stop at nothing to conquer the halls of power in Washington D.C.his secret weapon: his gorgeous, ambitious, andequally conniving wife Claire.”
}
/genreLists?page=4x4?props=name,boxshot[{id: 2523,boxshot: “http://…/018-192x50.png”
},{id: 5123,boxshot: “http://…/062-192x50.png”
},{id: 78432,boxshot: “http://…/923-70x50.png
},{id: 6342,boxshot: “http://…/9423-70x50.png
},
... ]
![Page 22: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/22.jpg)
RPC: No Cache Consistency
Title
Title
Title
Personalize
d
Genre Lists
/genreLists
?page=4x4
&props=name,title
/getTitleDetails?id=3432
Same info, two different URLS!
![Page 23: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/23.jpg)
RPC
• Low Latency
• Small Messages
• Tight coupling
• Manual Cache Management
![Page 24: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/24.jpg)
REST
• Cache Consistency
• Loose Coupling
RPC
• Small Message Sizes
• Low Latency
?
![Page 25: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/25.jpg)
FALCOR
![Page 26: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/26.jpg)
One Model Everywhere
![Page 27: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/27.jpg)
/model.json
![Page 28: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/28.jpg)
The Data is the API
![Page 29: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/29.jpg)
JSON
var member = new falcor.Model({
source: new HttpSource(‘/member.json’)});
Falcor JSON Model
var member = {
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
};
print(member[“location”][“address”]); member.getValue([“location”, “address”]).
toPromise().
then(print);
![Page 30: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/30.jpg)
Bind to the Cloud
![Page 31: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/31.jpg)
var memberModel = new falcor.Model(new falcor.HttpSource("/member.json"));
var MemberView = React.createClass({mixins: [FalcorComponent],renderContent: function() {
return this.props.model.get(["name"],function(name) {
return <div>Welcome {name}</div>;});
},renderLoading: function() {
return <div><img src="spinner.gif"></div>;}
});
React.render(<MemberView model={memberModel}/>);
MVC Framework Integration: React
var memberModel = new falcor.Model(new falcor.HttpSource("/member.json"));
var MemberView = React.createClass({mixins: [FalcorComponent],renderContent: function() {
return this.props.model.get(["name"],function(name) {
return <div>Welcome {name}</div>;});
},renderLoading: function() {
return <div><img src="spinner.gif"></div>;}
});
React.render(<MemberView model={memberModel}/>);
![Page 32: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/32.jpg)
Angular 2.0 (preview)
<div>
{{ model.getValue([“person”, “name”])|rx}} lives at {{ model.getValue([“person”, “address”])|rx }}
</div>
Steve McGuire lives at 344 Seaside
![Page 33: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/33.jpg)
What
When
Where
![Page 34: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/34.jpg)
What data do you want?Nothing Every value
![Page 35: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/35.jpg)
var member = new falcor.Model({
source: new falcor.HttpSource(“/member.json”)
});
member.get([“genreLists”, 0, “name”])
What data do you want?
member.
get([“genreLists”, {to:2}, {from:0, to:1}, “boxshot”]);
![Page 36: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/36.jpg)
When can data arrive?Now (sync) Later (async)
![Page 37: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/37.jpg)
When: Reactive Programming
Choose any async model:
• Promises (ES6)
• Observable (Proposed for ES7)
• Node-style Callbacks
• Node Streams
![Page 38: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/38.jpg)
Where is the data?Local Remote
![Page 39: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/39.jpg)
var member = {
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
}};
print(member[“location”][“address”]);
JSON
var member = new falcor.Model({cache:{
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
}});
print(member[“location”][“address”]);
Falcor
var member = {
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
};
print(member[“location”][“address”]);
var member = new falcor.Model({cache:{
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
}});
member.get( [“location”, “address”],
(address) => print(address)).
toPromise();
Falcor Server
var member = new falcor.Model({cache:{
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
}});
member.get( [“location”, “address”],
(address) => print(address)).
toPromise();
var member = new falcor.Model({cache:{
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
}});
(new falcor.HttpServer(member)).
listen(80);
var member = new falcor.Model({source:
new falcor.HttpSource(“member.json”)});
member.get( [“location”, “address”],
(address) => print(address)).
toPromise();
[“location”][“address”] member.get( [“location”, “address”]).toPromise().then(json => response.write(json));
![Page 40: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/40.jpg)
var member = new falcor.Model({source:
new falcor.HttpSource(“member.json”)});
member.get( [“location”, “address”],
(address) => print(address)).
toPromise();
Falcor
var member = new falcor.Model({cache:{
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
}});
(new falcor.HttpServer(member)).
listen(80);
Falcor Server
var member = new falcor.Model({cache:{
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
}});
(new falcor.HttpServer(member)).
listen(80);
Virtual Falcor Server
var member = new falcor.Model({
router: new falcor.Router([
{
route: [“member”,[“name”,”occupation”]],
get: (pathSet) =>
},
{
route: [“member”,“location”,[“country”, ”city”, “address”]],
get: (pathSet) =>
}
])
});
(new falcor.HttpServer(member)).listen(80);
var member = new falcor.Model({cache:{
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
}});
(new falcor.HttpServer(member)).
listen(80);
var member = new falcor.Model({
{
route: [“member”,[“name”,”occupation”]],
get: (pathSet) =>
memberDB.
exec(`SELECT ${pathSet[1].join(‘,’)}
FROM user
WHERE id = ${request.cookies.userid}`)
},
{
route: [“member”,“location”,[“country”, ”city”, “address”]],
get: (pathSet) =>
}
])
});
(new falcor.HttpServer(member)).listen(80);
var member = new falcor.Model({
{
route: [“member”,[“name”,”occupation”]],
get: (pathSet) =>
memberDB.
exec(`SELECT ${pathSet[1].join(‘,’)}
FROM user
WHERE id = ${request.cookies.userid}`)
},
{
route: [“member”,“location”,[“country”, ”city”, “address”]],
get: (pathSet) =>
locationServer.
getLocation(request.cookies.userid).
then(location => ({
member: { location: getProps(location, pathSet[2]) }
})
}
])
});
(new falcor.HttpServer(member)).listen(80);
![Page 41: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/41.jpg)
How do we do it efficiently?
![Page 42: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/42.jpg)
Falcor Optimization
• Batching
• Caching
• Path Optimization
![Page 43: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/43.jpg)
Building Netflix with Falcor
![Page 44: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/44.jpg)
Defining a Model
![Page 45: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/45.jpg)
![Page 46: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/46.jpg)
Netflix Member JSON Model
var member = {genreLists: [
{name: "Suggestions For You",titleList: [
{id: 523, name: "Friends", rating: 5,// more fields
},
// "Brain Games", "Spartacus"...],
},// "New Releases", "British TV Shows", ...
]}
var member = {genreLists: [
{name: "Suggestions For You",titleList: [
{id: 523, name: "Friends", rating: 5,// more fields
},
// "Brain Games", "Spartacus"...],
},// "New Releases", "British TV Shows", ...
]}
var member = {genreLists: [
{name: "Suggestions For You",titleList: [
{id: 523, name: "Friends", rating: 5,// more fields
},
// "Brain Games", "Spartacus"...],
},// "New Releases", "British TV Shows", ...
]}
![Page 47: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/47.jpg)
We’re almost ready to move our
model into the cloud.
http://netflix.com/member.json
![Page 48: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/48.jpg)
There’s just one problem…
![Page 49: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/49.jpg)
Netflix’s Domain Model is a Graph
![Page 50: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/50.jpg)
JSON is for Trees.
![Page 51: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/51.jpg)
When we convert a graph to a
JSON we get duplicates.
“Suggestions for You”
“New Releases”
Genre Lists
![Page 52: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/52.jpg)
Introducing JSON Graph
![Page 53: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/53.jpg)
JSON Graph
• Graph format for JSON
• Tree with Symbolic Links
• Every value type is a resource
![Page 54: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/54.jpg)
model[“genreLists”][0]["titlesList"][0][“name”] model[“genreLists”][0]["titlesList"][0][“name”]model.get([“genreLists”, 0, "titlesList”, 0, “name”])model.get([“genreLists”, 0, "titlesList”, 0, “name”])model.get([“genreLists”, 0, "titlesList”, 0, “name”])model.get([“genreLists”, 0, "titlesList”, 0, “name”])model.get([“genreLists”, 0, "titlesList”, 0, “name”])model.get([“genreLists”, 0, "titlesList”, 0, “name”])model.get([ “name”])model.get([ “titlesById” ,956, “name”])model.get([“titlesById”, 956, “name”]) model.get([“titlesById”, 956, “name”]) model.get([“titlesById”, 956, “name”]) model.get([“titlesById”, 956, “name”])
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
},
{
name: "New Releases",
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
}
]
}
JSON
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
},
{
name: "New Releases",
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
}
]
}
model[“genreLists”][0]["titlesList"][0][“name”]
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
},
{
name: "New Releases",
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
}
]
}
model[“genreLists”][0]["titlesList"][0][“name”]model[“genreLists”][0]["titlesList"][0][“rating”] = 5
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
},
{
name: "New Releases",
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
}
]
}
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
{
id: 956,
name: "Friends",
rating: 5
}
]
},
{
name: "New Releases",
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
}
]
}
model[“genreLists”][0]["titlesList"][0][“rating”] = 5
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
{
id: 956,
name: "Friends",
rating: 5
}
]
},
{
name: "New Releases",
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
}
]
}
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
{
id: 956,
name: "Friends",
rating: 5
}
]
},
{
name: "New Releases",
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
}
]
}
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
]
},
{
name: "New Releases",
titlesList: [
]
}
]
}
JSON Graph
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
]
},
{
name: "New Releases",
titlesList: [
]
}
],
titlesById: {
“956”: {
}
}
}
{
id: 956,
name: "Friends",
rating: 3
}
{
id: 956,
name: "Friends",
rating: 3
}
{
id: 956,
name: "Friends",
rating: 3
}
{
id: 956,
name: "Friends",
rating: 3
}
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
]
},
{
name: "New Releases",
titlesList: [
]
}
],
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
name: "Friends",
rating: 3
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
[“titlesById”, 956]
]
},
{
name: "New Releases",
titlesList: [
[“titlesById”, 956]
]
}
],
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
{
id: 956,
name: "Friends",
rating: 3
}
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
[“titlesById”, 956]
]
},
{
name: "New Releases",
titlesList: [
[“titlesById”, 956]
]
}
],
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
[“titlesById”, 956]
]
},
{
name: "New Releases",
titlesList: [
[“titlesById”, 956]
]
}
],
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
var model = {
genreLists: {
{
name: "Suggestions For You"
titlesList: [
[“titlesById”, 956]
]
},
{
name: "New Releases",
titlesList: [
[“titlesById”, 956]
]
}
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
var model = {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: [
[“titlesById”, 956]
]
},
“1”: {
name: "New Releases",
titlesList: [
[“titlesById”, 956]
]
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
var model = {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
}
},
“1”: {
name: "New Releases",
titlesList: {
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
“0”: ,
length: 75
“0”: ,
length: 75
[“titlesById”, 956]
[“titlesById”, 956]
var model = {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
var model = {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
var model = {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
“titlesById”, 956
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
model[“genreLists”][0]["titlesList"][0][“rating”] = 5 model.setValue(["genreLists", 0, "titlesList", 0, "rating"], 5)model.setValue(["genreLists", 0, "titlesList", 0, "rating"], 5)model.setValue([“genreLists”, 0, "titlesList”, 0, “rating”], 5)model.setValue([“genreLists”, 0, "titlesList”, 0, “rating”], 5)model.setValue([“genreLists”, 0, "titlesList”, 0, “rating”], 5)model.setValue([“genreLists”, 0, "titlesList”, 0, “rating”], 5)model.setValue([ “rating”], 5)model.setValue([ “titlesById” ,956, “rating”], 5)model.setValue([“titlesById”, 956, “rating”], 5) model.setValue([“titlesById”, 956, “rating”], 5) model.setValue([“titlesById”, 956, “rating”], 5)
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
“titlesById”, 956
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 5
}
}
});
model[“genreLists”][0]["titlesList"][0][“rating”] = 5
![Page 55: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/55.jpg)
JSON Graph: Small Resources
{
genreLists: {
“0”: {
name: “Suggestions for You”,
titlesList: {
“0”: [“titlesById”, 956],
“1”: [“titlesById”, 192],
// more titles
length: 75
},
},
length: 40
},
titlesById: {
“956”: { name: “Friends”, rating: 5 }
}
}
![Page 56: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/56.jpg)
JSON Graph
[“genreLists”, “length”]
[“genreLists”, *, name]
[“titlesById”, 23432, “name”]
[“titlesById”, 23432, “rating”]
[“titlesById”, 23432, “description”]
[“titlesById”, 23432, “bookmark”]
[“titlesById”, 23432, “director”]
// more fields
HTTP/REST
/genreLists
/titles/23432
Fine-Grained Resources
![Page 57: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/57.jpg)
Idempotent Operations
Falcor Model
get
set
HTTP/REST
GET
PUT
![Page 58: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/58.jpg)
Building a Virtual Model
http://netflix.com/member.json
![Page 59: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/59.jpg)
Virtual Model: Defining Routes
var member = new falcor.Model({router: new falcor.Router([
{route: ["genreLists", Router.INTEGERS, Router.INTEGERS],// example match: ["genreLists", [1,2,3], [1,5,2]]pathSet => {
// retrieve data from member’s personalized list DB// return as JSON Graph
},},{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],// example match: [“titlesById”, [2343,5123], [“name”]]pathSet => {
// retrieve data from title DB// return as JSON Graph
}}
])});
![Page 60: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/60.jpg)
Title Route
var member = new falcor.Model({router: new falcor.Router([// genre list route snipped{route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],// example match: [“titlesById”, [2343,5123], [“name”]]pathSet => {var titleIds = pathSet[1], fields = pathSet[2];titleStore.getTitlesByIds(titleIds).then(titles => {var titlesById = {};titles.forEach(title => {titlesById[title.id] = {};fields.forEach(field => titlesByid[title.id][field] = title[field]);
});
return { titlesById: titlesById };});
}])
});
![Page 61: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/61.jpg)
Virtual Model Path Evaluationvar member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
pathSet => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
pathSet => {{ /* retrieve data from titles DB */}
}
])
});
var member = new falcor.Model({
source: new falcor.HttpSource('member.json’)});
member.
getValue([“genreLists”, 0, 0, “name”]).
toPromise();
member.get(["genreLists", 0, 0, "name"])
var member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
([“genreList”],[0],[0]]) => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
pathSet => {{ /* retrieve data from titlesDB */}
}
])
});
var member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
pathSet => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
pathSet => {{ /* retrieve data from titles DB */}
}
]),
cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
}
}
});
var member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
pathSet => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
pathSet => {{ /* retrieve data from titles DB */}
}
]),
cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
}
}
});
member.get(["genreLists", 0, 0, "name"])
var member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
pathSet => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
pathSet => {{ /* retrieve data from titles DB */}
}
]),
cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
}
}
});
“titlesById”, 926
{
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
}
}
member.get([“titlesById”, 926, “name”])
var member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
pathSet => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
([“titlesById”, [926], [“aname”]]) => {{ /* retrieve data */}
}
]),
cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
}
}
});
var member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
pathSet => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
pathSet => {{ /* retrieve data from titles DB */}
}
]),
cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
},
titlesById: {
“926”: {
name: “Friends”
}
}
}
});
var member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
pathSet => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
pathSet => {{ /* retrieve data from titles DB */}
}
]),
cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
},
titlesById: {
“926”: {
name: “Friends”
}
}
}
});
var member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
pathSet => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
pathSet => {{ /* retrieve data from titles DB */}
}
]),
cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
},
titlesById: {
“926”: {
name: “Friends”
}
}
}
});
member.get([“titlesById”, 926, “name”])
{
titlesById: {
“926”: {
“name”: “Friends”
}
}
}cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
},
titlesById: {
“926”: {
name: “Friends”
}
}
}
var member = new falcor.Model({
source: new falcor.HttpSource('member.json’),
cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
},
titlesById: {
“926”: {
name: “Friends”
}
}
});
member.
getValue([“genreLists”, 0, 0, “name”]).
toPromise();
var member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
pathSet => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
pathSet => {{ /* retrieve data from titles DB */}
}
]);
![Page 62: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/62.jpg)
Virtual Model Path Evaluationvar member = new falcor.Model({
source: new falcor.HttpSource('member.json’),
cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
},
titlesById: {
“926”: {
name: “Friends”
}
}
}
});
member.
getValue([“genreLists”, 0, 0, “name”).
toPromise();member.get([“titlesById”, 926, “rating”])
var member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
pathSet => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
pathSet => {{ /* retrieve data from titles DB */}
}
]);
var member = new falcor.Model({
source: new falcor.HttpSource('member.json’),
cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
},
titlesById: {
“926”: {
name: “Friends”
}
}
}
});
member.
getValue([“genreLists”, 0, 0, “rating”]).
toPromise();
var member = new falcor.Model({
source: new falcor.HttpSource('member.json’),
cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
},
titlesById: {
“926”: {
name: “Friends”
}
}
}
});
member.
getValue([“titlesById”, 926, “rating”]).
toPromise();
![Page 63: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/63.jpg)
The World Wide Web is Flat
![Page 64: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/64.jpg)
The Type of the WWW
Map<String, Resource>
![Page 65: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/65.jpg)
The WWW is Flat
GET http://../genreLists/0/0/name
302 http://../titles/23432/name
GET http://../titles/23432/name
“Friends”
![Page 66: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/66.jpg)
The WWW is Flat (continued)
GET http://../genreLists/0/0/rating
302 http://../titles/23432/rating
GET http://../titles/23432/rating
5.0
![Page 67: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/67.jpg)
No Hierarchy
GET http://../genreLists/0/0/name
302 Redirect
http://../genreLists/0/0/*
http://../titles/23432/*
![Page 68: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/68.jpg)
Sets Are Idempotent
model.set(
{
path: [“titles”, 234324, “rating”],
value: 5
});
![Page 69: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/69.jpg)
Non Idempotent Operations
model.call(
[“genreList”,0,”add”],
[[“titles”, 234234]])
![Page 70: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/70.jpg)
Function Calls
• Can invoke function that lives anywhere in
Graph
• Functions can only be called, not
downloaded
• Functions can invalidate any resource in
cache
![Page 71: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/71.jpg)
Falcor
• Cache Consistency
• Loose Coupling
• Low Latency
• Small Message Sizes
![Page 72: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/72.jpg)
Additional Features
• Automatic Cache Management
– Items purged based on order in LRU
– Custom size can be applied to items
– One total size for all heterogenous types
• Fast Dirty Checking
– All set operations on leaves mark branches as dirty
– Can be used for fast model diff a la immutable types
![Page 73: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/73.jpg)
Mobile.js Web.js TV.js
Three JavaScript UIs
![Page 74: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/74.jpg)
Open-Source Soon
• Should be available in the next few
months
• Looking for help integrating with existing
MVC frameworks
• @falcorjs
![Page 75: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/75.jpg)
Questions?
![Page 76: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/76.jpg)
JSON Graph and REST
[“videosById”, 512]
[“genreLists”, 0, 0]
[“genreLists”,{to:5},{to:5},
/videosById/512
/genreLists?col=0&row=0
/genreLists
![Page 77: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/77.jpg)
JSON Graph
• Serializable Graph
• Fine-Grained
![Page 78: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/78.jpg)
cache: {
location: {
address: “344 Seaside”
}
}});
var member = new falcor.Model({source:
new falcor.HttpSource(“member.json”)});
Falcor Client
var member = new falcor.Model({
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
});
(new falcor.HttpServer(member)).
listen(80);
Falcor Server
member.
get([“location”, “address”],
(address) => <div>{address}></div>).
subscribe(jsx => updateUI(jsx));
var member = new falcor.Model({
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
});
(new falcor.HttpServer(member)).
listen(80);
,
member.
get([“location”,[“country”,“city”]],
(address) => <div>{address}></div>).
subscribe(jsx => updateUI(jsx));
location: {
country: “US”,
city: “Pacifica”,
}
location: {
country: “US”,
city: “Pacifica”,
}
![Page 79: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/79.jpg)
/member.json
![Page 80: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/80.jpg)
A Simple Issue Tracking App
![Page 81: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/81.jpg)
Issue Status
Inconsistent data displayed Open
Slow load times due to … Closed
Caching in browser is slow.. Resolved
Zip code is not validated Open
Switching profiles does… Closed
500 error incorrectly… Resolved
Template not updated… Open
Font is incorrect on user… Resolved
Dialog does not close… Open
Open and Assigned To Me
Issue Status
Inconsistent data displayed Open
Slow load times due to … Closed
Caching in browser is slow.. Resolved
Zip code is not validated Open
Switching profiles does… Closed
500 error incorrectly… Resolved
Template not updated… Open
Font is incorrect on user… Resolved
Dialog does not close… Open
Zip code is not validated
Currently we are not
validating ZIP Codes and
we are seeing a lot of
invalid data in the
database.
Description
Assigned To
Kim Trott
Status
Open
Lib added to build.
Issue Tracking
Lib added to build.
Add Comment
Kim Trott
![Page 82: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/82.jpg)
Issue Tracking: Domain Model
User
Issue Comment
![Page 83: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/83.jpg)
Let’s talk about REST.
![Page 84: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/84.jpg)
REST: Issue Tracking End
Points/user/{userId}
/issue/{issueId}
/comment/{commentId}
/user/{userId}/issues
/issue/{issueId}/comments
![Page 85: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/85.jpg)
User Resource: /user/5232
{name: “Kim Trott”,title: “Director”,twitter: “@alwayson”,email: “[email protected],// more fields…
}
![Page 86: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/86.jpg)
Issue Resource: /issue/926
{
name: “Zip code is not validated”,
description: “We need to apply…”,
status: “Resolved”,
dueDate: 956568342,
// more fields…
}
![Page 87: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/87.jpg)
Comment Resource: /comment/612
{
text: “What about the Canadians? Don’t we need to validate postal codes?”,
user: “/user/5232”
}
{
text: “What about the Canadians? Don’t we need to validate postal codes?”,
user: “/user/5232”
}
![Page 88: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/88.jpg)
User Issues: /users/5232/issues
[
“/issues/926”,
“/issues/696”,
“/issues/651”,
“/issues/2239”,
]
![Page 89: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/89.jpg)
/issues/926/comments
[
“/comments/912”,
“/comments/555”,
“/comments/61”,
“/comments/610
]
![Page 90: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/90.jpg)
Issue Tracking with REST
Your Issues
Issue Status
Inconsistent … Open
Zip code is… Open
Caching in us... Resolved
Test harness… Open
Switching prof Closed
500 error not… Resolved
Template not… Open
Font is incorr… Resolved
![Page 91: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/91.jpg)
R#0: GET /users/532/issues?
page=15
R#1: GET /issues/5412db.issues.get(5412)
R#2: GET /issues/926db.issues.get(926)
R#15: GET /issues/891db.issues.get(891)
...
SELECT TOP 15 issues
FROM user
WHERE
userId = 532
... ...
Your Issues
Issue Status
Inconsistent … Open
Zip code is… Open
Caching in us... Resolved
Test harness… Open
Switching prof Closed
500 error not… Resolved
Template not… Open
Font is incorr… Resolved
Issue Status
Inconsistent … Open
Zip code is… Open
Caching in us... Resolved
Test harness… Open
Switching prof Closed
500 error not… Resolved
Template not… Open
Font is incorr… Resolved
R#16: GET /issues/926
Zip code is not validated
Currently we are not
validating ZIP Codes
and we are seeing a lot
of invalid data in the
database.
Description
Assigned To
Kim Trott
Status
Open
Open
Resolved
Resolved
R#17: PUT/issues/926
db.issues.set(
891,
{
status: “Resolved”,
// more properties
));
SQ
L
No
SQ
L
Issue Tracking with RESTPhone
HTTP
Cache
Your Issues
Issue Status
Inconsistent … Open
Zip code is… Resolved
Caching in us... Resolved
Test harness… Open
Switching prof Closed
500 error not… Resolved
Template not… Open
Font is incorr… Resolved
HTTP/1.0 200 OK
“/issues/5412”,“/issues/926”,“/issues/6293”,“/issues/6102”,“/issues/9232”,“/issues/16”,“/issues/0239”,“/issues/7623”,“/issues/2239”,“/issues/512”,“/issues/523”,“/issues/9823”,“/issues/615”,“/issues/2267”,“/issues/612”,
HTTP/1.0 200 OK
name: “Inconsistent formatting applied to dates.”,
description: “We need to apply…”,
status: “Open”,
dueDate: 956568342,
// more fields…
![Page 92: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/92.jpg)
Phone HTTP Cache
REST: Cache Coherence
Issue DB
Issue Issue Issue
Issue Issue Issue
Issue Issue Issue
Issue Issue Issue
Issue Issue Issue
User DB
User
Issue Issue Issue
Issue Issue Issue
Issue Issue Issue
Issue Issue Issue
Issue Issue Issue
User
![Page 93: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/93.jpg)
REST = Laaaaaaaattteeennccccyy
![Page 94: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/94.jpg)
Overfetching with REST
{
name: “Zip code is not validated”,
description: “We need to apply…”,
status: “Resolved”,
dueDate: 956568342,
// more fields…
}
/issues/26343
description: “We need to apply…”,
![Page 95: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/95.jpg)
Issue Tracking with RPC
Your Issues
Issue Status
Inconsistent … Open
Zip code is… Open
Caching in us... Resolved
Test harness… Open
Switching prof Closed
500 error not… Resolved
Template not… Open
Font is incorr… Resolved
![Page 96: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/96.jpg)
RPC: Stale Caches
![Page 97: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/97.jpg)
RPC: Gerrymandered “Resource”
User
IssueIssueIssueIssueIssueIssueIssueIssueIssueIssueIssueIssue
issueList
![Page 98: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/98.jpg)
RPC: Tight Coupling
Your Issues
Issue Status
Inconsistent … Open
Zip code is… Open
Caching in us... Resolved
Test harness… Open
Switching prof Closed
500 error not… Resolved
Template not… Open
Font is incorr… Resolved
Issue Status Last Comment
Inconsistent forma… Open “Could we just…”
Zip code is… Open “Canadian postal?”
Caching in us... Resolved “Why manage it…
Test harness… Open “Should take a
while.”
Switching profiles… Closed “Cut loading time…”
![Page 99: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/99.jpg)
REST
• Cache Consistency
• Loose Coupling
RPC
• Small Message Size
• Low Latency
![Page 100: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/100.jpg)
• Distributed Architecture for Web Applications
• Support Idempotent Operations and RPC calls
• Maximize Cache Utility, Minimize Message Size
![Page 101: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/101.jpg)
How it works
![Page 102: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/102.jpg)
Issue Tracking with Falcor
Your Issues
Issue Status
Inconsistent … Open
Zip code is… Open
Caching in us... Resolved
Test harness… Open
Switching prof Closed
500 error not… Resolved
Template not… Open
Font is incorr… Resolved
![Page 103: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/103.jpg)
• Distributed Architecture for Web Applications
• Maximize Cache Utility, Minimize Message Sizes
• Support for Idempotent Operations and RPC calls
![Page 104: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/104.jpg)
Most domain models are Graphs.
![Page 105: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/105.jpg)
![Page 106: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/106.jpg)
JSON Graph
var model = {user: {id: 5232,name: “Kim Trott”,// more props…issues: [{id: 926name: “Zip code is not validated”,// more props…assignedTo: { … }comments: [{id: 612text: “Is there a library?”,user: { … }
},// more comments…
]},// more issues
]}
}
var model = new falcor.Model({cache: {user: {id: 5232,name: “Kim Trott”,// more properties…issues: [{id: 926name: “Zip code is not validated”,// more propertiesassignedTo: { … }comments: [{id: 612text: “Is there a library?”,user: { … }
},// more comments…
]},// more issues
]},
}});model[“user”][“issues”][0][“comments”][“0”][“text”]
![Page 107: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/107.jpg)
REST End Points
![Page 108: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/108.jpg)
REST
/issues/{id}
/users/{id}
![Page 109: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/109.jpg)
yahoo.com nytimes.com/942
yahoo.com/banner.png
slate.com
slate.com/9565
reddit.com
Key Value
Browser CacheGET slate.com
GET slate.com
PUT slate.com
Key Value
slate.com <html><head…
GET slate.com/9565
GET slate.com/9565
PUT slate.com/9565
XKey Value
slate.com <html><head…
Key Value
slate.com <html><head…
slate.com/9565 <html><head…
Key Value
slate.com <html><head…
slate.com/9565 <html><head…
Key Value
slate.com <html><head…
slate.com/9565 <html><head…
![Page 110: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/110.jpg)
The Power of Idempotence
GET /genreLists/0/name
PUT /genreLists/0/0/rating
5
![Page 111: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/111.jpg)
PathSets
[“genreLists”, {from: 0, to: 5}, “titles”, {to:3}, [“name”, “rating”]]
![Page 112: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/112.jpg)
![Page 113: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/113.jpg)
How do we do it efficiently?
1.Batching
2.Caching
3.Path Optimization
![Page 114: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/114.jpg)
Most domain models are Graphs.
![Page 115: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/115.jpg)
How do we store a graph as
JSON without duplicates?
![Page 116: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/116.jpg)
Introducing JSON Graph
![Page 117: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/117.jpg)
model[“genreLists”][0]["titlesList"][0][“name”] model[“genreLists”][0]["titlesList"][0][“name”]model.get([“genreLists”, 0, "titlesList”, 0, “name”])model.get([“genreLists”, 0, "titlesList”, 0, “name”])model.get([“genreLists”, 0, "titlesList”, 0, “name”])model.get([“genreLists”, 0, "titlesList”, 0, “name”])model.get([“genreLists”, 0, "titlesList”, 0, “name”])model.get([“genreLists”, 0, "titlesList”, 0, “name”])model.get([ “name”])model.get([ “titlesById” ,956, “name”])model.get([“titlesById”, 956, “name”]) model.get([“titlesById”, 956, “name”]) model.get([“titlesById”, 956, “name”]) model.get([“titlesById”, 956, “name”])
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
},
{
name: "New Releases",
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
}
]
}
JSON
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
},
{
name: "New Releases",
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
}
]
}
model[“genreLists”][0]["titlesList"][0][“name”]
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
},
{
name: "New Releases",
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
}
]
}
model[“genreLists”][0]["titlesList"][0][“name”]model[“genreLists”][0]["titlesList"][0][“rating”] = 5
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
},
{
name: "New Releases",
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
}
]
}
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
{
id: 956,
name: "Friends",
rating: 5
}
]
},
{
name: "New Releases",
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
}
]
}
model[“genreLists”][0]["titlesList"][0][“rating”] = 5
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
{
id: 956,
name: "Friends",
rating: 5
}
]
},
{
name: "New Releases",
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
}
]
}
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
{
id: 956,
name: "Friends",
rating: 5
}
]
},
{
name: "New Releases",
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
}
]
}
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
]
},
{
name: "New Releases",
titlesList: [
]
}
]
}
JSON Graph
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
]
},
{
name: "New Releases",
titlesList: [
]
}
],
titlesById: {
“956”: {
}
}
}
{
id: 956,
name: "Friends",
rating: 3
}
{
id: 956,
name: "Friends",
rating: 3
}
{
id: 956,
name: "Friends",
rating: 3
}
{
id: 956,
name: "Friends",
rating: 3
}
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
]
},
{
name: "New Releases",
titlesList: [
]
}
],
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
name: "Friends",
rating: 3
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
[“titlesById”, 956]
]
},
{
name: "New Releases",
titlesList: [
[“titlesById”, 956]
]
}
],
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
{
id: 956,
name: "Friends",
rating: 3
}
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
[“titlesById”, 956]
]
},
{
name: "New Releases",
titlesList: [
[“titlesById”, 956]
]
}
],
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
[“titlesById”, 956]
]
},
{
name: "New Releases",
titlesList: [
[“titlesById”, 956]
]
}
],
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
var model = {
genreLists: {
{
name: "Suggestions For You"
titlesList: [
[“titlesById”, 956]
]
},
{
name: "New Releases",
titlesList: [
[“titlesById”, 956]
]
}
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
var model = {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: [
[“titlesById”, 956]
]
},
“1”: {
name: "New Releases",
titlesList: [
[“titlesById”, 956]
]
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
var model = {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
}
},
“1”: {
name: "New Releases",
titlesList: {
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
“0”: ,
length: 75
“0”: ,
length: 75
[“titlesById”, 956]
[“titlesById”, 956]
var model = {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
var model = {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
var model = {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
“titlesById”, 956
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
model[“genreLists”][0]["titlesList"][0][“rating”] = 5 model.setValue(["genreLists", 0, "titlesList", 0, "rating"], 5)model.setValue(["genreLists", 0, "titlesList", 0, "rating"], 5)model.setValue([“genreLists”, 0, "titlesList”, 0, “rating”], 5)model.setValue([“genreLists”, 0, "titlesList”, 0, “rating”], 5)model.setValue([“genreLists”, 0, "titlesList”, 0, “rating”], 5)model.setValue([“genreLists”, 0, "titlesList”, 0, “rating”], 5)model.setValue([ “rating”], 5)model.setValue([ “titlesById” ,956, “rating”], 5)model.setValue([“titlesById”, 956, “rating”], 5) model.setValue([“titlesById”, 956, “rating”], 5) model.setValue([“titlesById”, 956, “rating”], 5)
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
“titlesById”, 956
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
});
var model = new falcor.Model({ cache: {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
“1”: {
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 5
}
}
});
model[“genreLists”][0]["titlesList"][0][“rating”] = 5
![Page 118: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/118.jpg)
var member = new falcor.Model({
location: {
country: {
$type: “sentinel”,
$expires: 0,
value: “US”
}
}
});
(new falcor.HttpServer(member)).
listen(80);
Expire Immediately
var member = new falcor.Model({
location: {
country: {
$type: “sentinel”,
$expires: 1,
value: “US”
}
}
});
(new falcor.HttpServer(member)).
listen(80);
Expire NeverExpire at Absolute Time
var member = new falcor.Model({
location: {
country: {
$type: “sentinel”,
$expires: 32648963422,
value: “US”
}
}
});
(new falcor.HttpServer(member)).
listen(80);
var member = new falcor.Model({
location: {
country: {
$type: “sentinel”,
$expires: -20000,
value: “US”
}
}
});
(new falcor.HttpServer(member)).
listen(80);
Expire at Relative Time
![Page 119: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/119.jpg)
Get as JSON
var member = new falcor.Model({
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
});
{
“json”:{
name: “Steve McGuire”,
location: {
address: “344 Seaside”
}
}
}
member.get(
[“name”],
[“location”, “address”]).
subscribe(json => console.log(json));
![Page 120: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/120.jpg)
Get as Path Values
var member = new falcor.Model({
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
});
{path: [“name”], value: “Steve McGuire”}
{path: [“location”, “country”], value: “US”}
member.get(
[“name”],
[“location”, “country”]).
toPathValues()
subscribe(pathValue =>
console.log(jpathValue));
![Page 121: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/121.jpg)
Get with Selector Function
var member = new falcor.Model({
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
});
<div>Steve McGuire lives in US</div>
member.
get(
[“name”],
[“location”, “country”],
(name, country) =>
<div>{name} lives in {country}</div>).
subscribe(jsx =>
console.log(jsx));
![Page 122: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/122.jpg)
Get with Fast Selector Function
var member = new falcor.Model({
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
});
<div>Steve McGuire lives in US</div>
member.
get(
[“name”],
[“location”, “country”],
() =>
<div>{this.getValueSync([“name”)} lives
in {this.getValueSync([“location”, “country”])}</div>).
subscribe(jsx =>
console.log(jsx));
![Page 123: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/123.jpg)
Introducing Dense JSON
![Page 124: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/124.jpg)
Selector Fn Arguments get Dense JSON
member.
get(
[“location”, [“country”, “address”]],
(location) => locationx).
subscribe(json => console.log(json));
member.
get(
[“location”, [“country”, “address”]).
subscribe(json => console.log(json));
{
location: {
country: “US”,
address: “344 Seaside”
}
}
{
country: “US”,
address: “344 Seaside”
}
![Page 125: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/125.jpg)
{
location: {
country: {
$type: “sentinel”,
$expires: 0,
value: “US”
}
city: “Pacifica”,
}
});
var member = new falcor.Model(
new falcor.HttpSource(“member.json”));
Falcor Client
var member = new falcor.Model({
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: {
$type: “sentinel”,
$expires: 0,
value: “US”
},
city: “Pacifica”,
address: “344 Seaside”
}
});
(new falcor.HttpServer(member)).
listen(80);
Falcor Server
,
member.
get([“location”,[“country”,“city”]],
(address) =>
<div>{city},{country}></div>).
subscribe(jsx => updateUI(jsx));
var member = new falcor.Model({
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
});
(new falcor.HttpServer(member)).
listen(80);
var member = new falcor.Model({
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: {
$type: “sentinel”,
$expires: 0,
value: “US”
},
city: “Pacifica”,
address: “344 Seaside”
}
});
(new falcor.HttpServer(member)).
listen(80);
location: {
country: {
$type: “sentinel”,
$expires: 0,
value: “US”
}
city: “Pacifica”,
}
{
location: {
city: “Pacifica”,
}
});
![Page 126: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/126.jpg)
What about REST/HTTP?
![Page 127: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/127.jpg)
Heavyweight HTTP
![Page 128: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/128.jpg)
Easy React Integration
1.Async Rendering
2.Fast Model Diffing
![Page 129: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/129.jpg)
render: function() {
var jsx,
jsxReceived = false;
var model = new falcor.Model(
new falcor.DataSource(“member.json”));
model.get(
[“name”],
[“location”, “city”],
[“location”, “address”],
(name, city, address) => {
jsx = <p>{name} lives at
<span>{address}, {city}</span></p>;
if (!jsxReceived) this.forceUpdate();
}).
toPromise();
if (jsx) {
jsxReceived = true;
return jsx;
}
else {
return <img src=“progress.gif” />;
}
}
Async Component Render
Steve McGuire lives at 344 Seaside, Pacifica
render: function() {
var jsx,
jsxReceived = false;
var model = new falcor.Model(
new falcor.DataSource(“member.json”));
model.get(
[“name”],
[“location”, “city”],
[“location”, “address”],
(name, city, address) => {
jsx = <p>{name} lives at
<span>{address}, {city}</span></p>;
if (!jsxReceived) this.forceUpdate();
}).
toPromise();
if (jsx) {
jsxReceived = true;
return jsx;
}
else {
return <img src=“progress.gif” />;
}
}
render: function() {
var jsx,
jsxReceived = false;
var model = new falcor.Model(
new falcor.DataSource(“member.json”));
model.get(
[“name”],
[“location”, “city”],
[“location”, “address”],
(name, city, address) => {
jsx = <p>{name} lives at
<span>{address}, {city}</span></p>;
if (!jsxReceived) this.forceUpdate();
}).
toPromise();
if (jsx) {
jsxReceived = true;
return jsx;
}
else {
return <img src=“progress.gif” />;
}
}
render: function() {
var jsx,
jsxReceived = false;
var model = new falcor.Model(
new falcor.DataSource(“member.json”));
model.get(
[“name”],
[“location”, “city”],
[“location”, “address”],
(name, city, address) => {
jsx = <p>{name} lives at
<span>{address}, {city}</span></p>;
if (!jsxReceived) this.forceUpdate();
}).
toPromise();
if (jsx) {
jsxReceived = true;
return jsx;
}
else {
return <img src=“progress.gif” />;
}
}
renderData: function(name, city, address) {
return <p>{name} lives at
<span>{address}, {city}</span></p>;
},
renderProgress: function() {
return <img src=“progress.gif” />;
}
getPaths: function() {
return [
[“name”],
[“location”, “city”],
[“location”, “address”]
];
}
![Page 130: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/130.jpg)
Fast Model Diffing
shouldComponentUpdate: function(nextProps, nextState, nextContext) {
return (this.state.generation !== nextState.generation) ||
(this.state.key !== nextState.key);
}
![Page 131: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/131.jpg)
New, more convenient API.
![Page 132: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/132.jpg)
One Model Everywhere
![Page 133: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/133.jpg)
JSON
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
},
{
name: "New Releases",
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
}
]
}
model[“genreLists”][0]["titlesList"][0][“name”]
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
},
{
name: "New Releases",
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
}
]
}
model[“genreLists”][0]["titlesList"][0][“name”]model[“genreLists”][0]["titlesList"][0][“rating”] = 5
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
},
{
name: "New Releases",
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
}
]
}
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
{
id: 956,
name: "Friends",
rating: 5
}
]
},
{
name: "New Releases",
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
}
]
}
model[“genreLists”][0]["titlesList"][0][“rating”] = 5
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
{
id: 956,
name: "Friends",
rating: 5
}
]
},
{
name: "New Releases",
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
}
]
}
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
{
id: 956,
name: "Friends",
rating: 5
}
]
},
{
name: "New Releases",
titlesList: [
{
id: 956,
name: "Friends",
rating: 3
}
]
}
]
}
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
]
},
{
name: "New Releases",
titlesList: [
]
}
]
}
JSON Graph
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
]
},
{
name: "New Releases",
titlesList: [
]
}
],
titlesById: {
“956”: {
}
}
}
{
id: 956,
name: "Friends",
rating: 3
}
{
id: 956,
name: "Friends",
rating: 3
}
{
id: 956,
name: "Friends",
rating: 3
}
{
id: 956,
name: "Friends",
rating: 3
}
{
id: 956,
name: "Friends",
rating: 3
}
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
]
},
{
name: "New Releases",
titlesList: [
]
}
],
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
name: "Friends",
rating: 3
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
[“titlesById”, 956]
]
},
{
name: "New Releases",
titlesList: [
[“titlesById”, 956]
]
}
],
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
{
id: 956,
name: "Friends",
rating: 3
}
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
[“titlesById”, 956]
]
},
{
name: "New Releases",
titlesList: [
[“titlesById”, 956]
]
}
],
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
var model = {
genreLists: [
{
name: "Suggestions For You"
titlesList: [
[“titlesById”, 956]
]
},
{
name: "New Releases",
titlesList: [
[“titlesById”, 956]
]
}
],
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
var model = {
genreLists: {
{
name: "Suggestions For You"
titlesList: [
[“titlesById”, 956]
]
},
{
name: "New Releases",
titlesList: [
[“titlesById”, 956]
]
}
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
var model = {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: [
[“titlesById”, 956]
]
},
“1”: {
name: "New Releases",
titlesList: [
[“titlesById”, 956]
]
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
var model = {
genreLists: {
“0”: {
name: "Suggestions For You"
titlesList: {
}
},
“1”: {
name: "New Releases",
titlesList: {
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
“0”: ,
length: 75
“1”: ,
length: 75
[“titlesById”, 956]
[“titlesById”, 956]
var model = {
genreLists: {
{
name: "Suggestions For You"
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
{
name: "New Releases",
titlesList: {
“0”: [“titlesById”, 956],
length: 75
}
},
length: 50
},
titlesById: {
“956”: {
name: "Friends",
rating: 3
}
}
}
![Page 134: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/134.jpg)
![Page 135: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/135.jpg)
In the last 10 years, the web has transformed.
![Page 136: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/136.jpg)
In the last 10 years, the web has transformed.
![Page 137: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/137.jpg)
Issue Tracking: REST End
Points/user/{userid}
/issue/{issueid}
/comment/{commentid}
/user/{userid}/issues
/issue/{issueid}/comments
![Page 138: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/138.jpg)
Every user wants to believe that the
entire cloud is on their device.
![Page 139: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/139.jpg)
R#0: GET /genreLists/124
?pageSize=15
R#1: GET /titles/5412titleDB.get(5412)
R#2: GET /titles/926titleDB.get(926)
R#15: GET /titles/891titleDB.get(891)
...
userDB.lists.
get(124).
top(15);
... ...
Users Titles
Why not REST?Phone
HTTP
Cache
R#15: GET /titles/926
![Page 140: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/140.jpg)
R#0: GET /issueList?
page=15userDB.lists.get(532)
Users Titles
Netflix with RPC
Memory
Cache
titleDB.get([
5412, 926…612
], “name,status”);
Phone
HTTP
Cache
![Page 141: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/141.jpg)
HTTP/REST is for Large
Resources
The REST interface is designed
to be efficient for large-grain
hypermedia data
transfer…resulting in an interface
that is not optimal for other forms
of architectural interaction.
-Dr Roy T Fielding
![Page 142: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/142.jpg)
var member = {
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
}};
print(member[“location”][“address”]);
JSON
var member = new falcor.Model({cache:{
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
}});
print(member[“location”][“address”]);
Falcor
var member = {
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
};
print(member[“location”][“address”]);
var member = new falcor.Model({cache:{
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
}});
member.get( [“location”, “address”],
(address) => print(address)).
toPromise();
Falcor Server
var member = new falcor.Model({cache:{
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
}});
member.get( [“location”, “address”],
(address) => print(address)).
toPromise();
var member = new falcor.Model({cache:{
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
}});
(new falcor.HttpServer(member)).
listen(80);
var member = new falcor.Model({source:
new falcor.HttpSource(“member.json”)});
member.get( [“location”, “address”],
(address) => print(address)).
toPromise();
member.get( [“location”, “address”]).toPromise().then(json => response.write(json));
[“location”][“address”]
![Page 143: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/143.jpg)
var member = new falcor.Model({source:
new falcor.HttpSource(“member.json”)});
member.get( [“location”, “address”],
(address) => print(address)).
toPromise();
Falcor
var member = new falcor.Model({cache:{
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
}});
(new falcor.HttpServer(member)).
listen(80);
Falcor Server
var member = new falcor.Model({cache:{
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
}});
(new falcor.HttpServer(member)).
listen(80);
Virtual Falcor Server
var member = new falcor.Model({
router: new falcor.Router([
{
route: [“member”,[“name”,”occupation”]],
get: (pathSet) =>
},
{
route: [“member”,“location”,[“country”, ”city”, “address”]],
get: (pathSet) =>
}
])
});
(new falcor.HttpServer(member)).listen(80);
var member = new falcor.Model({cache:{
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
}});
(new falcor.HttpServer(member)).
listen(80);
var member = new falcor.Model({
{
route: [“member”,[“name”,”occupation”]],
get: (pathSet) =>
memberDB.
exec(`SELECT ${pathSet[1].join(‘,’)}
FROM user
WHERE id = ${request.cookies.userid}`)
},
{
route: [“member”,“location”,[“country”, ”city”, “address”]],
get: (pathSet) =>
}
])
});
(new falcor.HttpServer(member)).listen(80);
var member = new falcor.Model({
{
route: [“member”,[“name”,”occupation”]],
get: (pathSet) =>
memberDB.
exec(`SELECT ${pathSet[1].join(‘,’)}
FROM user
WHERE id = ${request.cookies.userid}`)
},
{
route: [“member”,“location”,[“country”, ”city”, “address”]],
get: (pathSet) =>
locationServer.
getLocation(request.cookies.userid).
then(location => ({
member: { location: getProps(location, pathSet[2]) }
})
}
])
});
(new falcor.HttpServer(member)).listen(80);
![Page 144: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/144.jpg)
cache: {
location: {
address: “344 Seaside”
}
}});
var member = new falcor.Model({source:
new falcor.HttpSource(“member.json”)});
Falcor Client
var member = new falcor.Model({
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
});
(new falcor.HttpServer(member)).
listen(80);
Falcor Server
member.
get([“location”, “address”]).
toPromise();
var member = new falcor.Model({
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
});
(new falcor.HttpServer(member)).
listen(80);
,
member.
get([“location”,[“country”,“city”]]).
toPromise();
location: {
country: “US”,
city: “Pacifica”,
}
location: {
country: “US”,
city: “Pacifica”,
}
![Page 145: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/145.jpg)
cache: {
location: {
address: “344 Seaside”
}
}});
var member = new falcor.Model({source:
new falcor.HttpSource(“member.json”)});
Falcor Client
var member = new falcor.Model({
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
});
(new falcor.HttpServer(member)).
listen(80);
Falcor Server
member.
get([“location”, “address”],
(address) => <div>{address}></div>).
subscribe(jsx => updateUI(jsx));
var member = new falcor.Model({
name: “Steve McGuire”,
occupation: “Developer”,
location: {
country: “US”,
city: “Pacifica”,
address: “344 Seaside”
}
});
(new falcor.HttpServer(member)).
listen(80);
,
member.
get([“location”,[“country”,“city”]],
(address) => <div>{address}></div>).
subscribe(jsx => updateUI(jsx));
location: {
country: “US”,
city: “Pacifica”,
}
location: {
country: “US”,
city: “Pacifica”,
}
![Page 146: FALCOR - Software Development Conference Web Server Application Server ... Building Netflix with Falcor. ... Open-Source Soon • Should be available in the next few months](https://reader031.vdocument.in/reader031/viewer/2022022520/5b1f54b87f8b9a1b1e8b4c33/html5/thumbnails/146.jpg)
Virtual Model Path Evaluationvar member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
pathSet => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
pathSet => {{ /* retrieve data from titles DB */}
}
])
});
var member = new falcor.Model({
source: new falcor.HttpSource('member.json’)});
member.
getValue([“genreLists”, 0, 0, “name”]).
toPromise();
member.get(["genreLists", 0, 0, "name"])
var member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
([“genreList”],[0],[0]]) => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
pathSet => {{ /* retrieve data from titlesDB */}
}
])
});
var member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
pathSet => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
pathSet => {{ /* retrieve data from titles DB */}
}
]),
cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
}
}
});
var member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
pathSet => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
pathSet => {{ /* retrieve data from titles DB */}
}
]),
cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
}
}
});
member.get(["genreLists", 0, 0, "name"])
var member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
pathSet => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
pathSet => {{ /* retrieve data from titles DB */}
}
]),
cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
}
}
});
“titlesById”, 926
{
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
}
}
member.get([“titlesById”, 926, “name”])
var member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
pathSet => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
([“titlesById”, [926], [“aname”]]) => {{ /* retrieve data */}
}
]),
cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
}
}
});
var member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
pathSet => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
pathSet => {{ /* retrieve data from titles DB */}
}
]),
cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
},
titlesById: {
“926”: {
name: “Friends”
}
}
}
});
var member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
pathSet => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
pathSet => {{ /* retrieve data from titles DB */}
}
]),
cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
},
titlesById: {
“926”: {
name: “Friends”
}
}
}
});
var member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
pathSet => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
pathSet => {{ /* retrieve data from titles DB */}
}
]),
cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
},
titlesById: {
“926”: {
name: “Friends”
}
}
}
});
member.get([“titlesById”, 926, “name”])
{
titlesById: {
“926”: {
“name”: “Friends”
}
}
}cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
},
titlesById: {
“926”: {
name: “Friends”
}
}
}
var member = new falcor.Model({
source: new falcor.HttpSource('member.json’),
cache: {
genreLists: {
“0”: {
“0”: [“titlesById”, 926]
}
},
titlesById: {
“926”: {
name: “Friends”
}
}
});
member.
getValue([“genreLists”, 0, 0, “name”]).
toPromise();
var member = new falcor.Model({
router: new falcor.Router([
{
route: ["genreLists", Router.INTEGERS, Router.INTEGERS],
pathSet => { /* retrieve data from lists DB */},
},
{
route: [“titlesById”, Router.INTEGERS, [“name”, “rating”]],
pathSet => {{ /* retrieve data from titles DB */}
}
]);
“titlesById”, 926