Code Monkey home page Code Monkey logo

go-activitystream's Introduction

ActivityStream

Status: Build Status Coverage Status

This project helps implementing an activitystream (social feed) following the fan-out on write approach:

  1. [on Write] Aggregate interested parties
  2. [on Write] Write/store to their streams
  3. [on Read] Retrieve stream

In opposite to fan-in on read which would consist of:

  1. [on Write] Write/store activities
  2. [on Read] Aggregate interesting parties
  3. [on Read] Read from their streams (and aggregate them)

It realises the second and third part of a fan-out on write efficiently using Redis. It provides an interface which can be used to replace Redis with other databases/storages (Groupcache would be interesting! I may play with it in future). The project also defines a way of pagination following Facebook's approach, as well as a format for storing an Activity, which is based on the definition on activitystrea.ms. The Redis implementation stores activities just once and writes their ID to the specified streams.

Complete Example Architecture

Requirements

Assuming in a system people can follow each other, see their Followings' activities as a "homestream" and a person's activity on her/his profile. So we need the following:

  • An outbox stream for every person, identified as "PERSON_ID-out", which will be shown on the person's profile.
  • An inbox stream for every person, identified as "PERSON_ID", which will be shown as homestream of followers.

When an activity occurs:

  1. Create a new Activity object.
  2. Retrieve list of followers
  3. Call activitystream.AddToStream with the activity using the followers inbox-ids + the actor's outbox-id.

API

In our case I implemented an API service which accepts new activities, aggregates interested parties (followers), stores activities and returns streams.

Data returned for an outbox

data_compact

links

Contribution

Suggestions and Bug reports can be made through Github issues. Contributions are welcomed, there is currently no need to open an issue for it, but please follow the code style, including descriptive tests with GoConvey.

License

Licensed under Apache 2.0.

go-activitystream's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.