0.02
No commit activity in last 3 years
No release in over 3 years
DataMapper adapter for Riak
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

~> 1.0.0
~> 0.8.0
 Project Readme

dm-riak-adapter

DataMapper adapter for the Dynamo-inspired key/value store, Riak.

Install

Requires that you have Riak installed. You can download the latest release here, or install using homebrew:

  brew install riak

Install the dm-riak-adapter gem:

  gem install dm-riak-adapter

Synopsis

Require dm-core and dm-riak-adapter. Tell DataMapper to use the Riak adapter and set a namespace for your app. This namespace will prefix each bucket like todo:projects todo:tasks. Skip setting a namespace and the buckets will have no prefix.

  require 'dm-core'
  require 'dm-riak-adapter'
  
  DataMapper.setup :default, :adapter => 'riak', :namespace => 'todo'

Continue defining your models and properties as you normally would. Set a property as type Key to use Riak's server-assigned UUIDs.

  class Project
    include DataMapper::Resource
    
    property :id,   Key
    property :name, String
    
    has n, :tasks
  end
  
  class Task
    include DataMapper::Resource
    
    property :id,       Key
    property :summary,  String
    
    belongs_to :project
  end

Resources