Recently Cloud Functions has released on Firebase.
I'm developing social network service via Firebase and using "Fan-out" process for data consistency as explained on here.
Since "Client-side fan-out" is a bit inefficient for large data. Can we resolve this on Server-side with Cloud Functions?
If possible, can you guys give me a workaround to do this. Or if there is sample code with it please reference me.
For examples, if new data is inserted on posts node, how can we Fan-out this data on timeline node for each following user?
Thank you.
{
"posts": {
"-K-zOrtjiCGe7tgRk8DG": {
"text": "I love emojis!",
"uid": "user1"
}
},
"timeline": {
"user2": {
"-K-zOrtjiCGe7tgRk8DG": {
"text": "I love emojis!",
"uid": "user1"
}
},
"user3": {
"-K-zOrtjiCGe7tgRk8DG": {
"text": "I love emojis!",
"uid": "user1"
}
}
},
"followers": {
"user1": {
"user2": true,
"user3": true
}
}
}
via wonsuc
No comments:
Post a Comment