The content service is dedicated to storing and retrieving raw content (posts) generated by users. It serves as the system of record for all posts and stores the full post content indexed primarily by post id. Socialite defines a very simple interface and corresponding default implementation.
$ db.content.find()
{"_id" : ObjectId("...dd2"), "_a" : "ian", "_m" : "message from ian"}
{"_id" : ObjectId("...dc1"), "_a" : "djw", "_m" : "message from daz"}
{"_id" : ObjectId("...da7"), "_a" : "ian", "_m" : "earlier from ian"}
In the initial version, the main requirements of the content service are :
- Allow content to be added by user and allocated a unique id.
- Perform basic validation on content
- Allow content to be found by id
- Allow content to be queried by user, anchor (a content id that represents a point in time) and returned ordered by time
Depending on the feed service model used, the role of (and the load placed upon) the Content Service can vary considerably. For fanout-on-read systems, the Content Service will be asked to construct timelines on the fly as users request them. At the other end of the scale, a fanout-on-write based feed service that embeds all content may rarely hit the Content Service for serving feeds at all.