Store user timelines in Riak.
Pull request Compare This branch is even with roidrage:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
spec
.gitignore
Gemfile
README.md
Rakefile
riaktivity.gemspec

README.md

Riaktivity

Store timelines in Riak with Ruby. A work in progress.

Stores a list of items in Riak, converges conflicting updates on both read and write, keeping the list at a configurable length. Inspired by Yammer's Streamie and Disqus' timak.

Assumptions

  • Unique IDs are generated elsewhere. They only need to be unique per entry, not per user feed
  • Each entry includes a timestamp, based on which data is sorted
  • Feeds are capped on size to prevent exponential growth
  • Data on who follows who is maintained elsewhere

Usage

class User
  include Riaktivity

  def add_entry(activity)
    add_activity(user_id, activity)
  end

  def get_feed()
    get_timeline(user_id)
  end
end

user = User.new(user_id: "roidrage")
user.add_entry(id: UUID.new, timestamp: Time.now, category: 'troll-face', properties: {entry_id: 2134})

Configuration

Riaktivity.options = {host: '192.168.2.1',
                      protocol: 'pbc',
                      capped_at: 100,
                      bucket: 'troll-feed'}