Introducing Ripple 0.5: "You Got your Riak in my Ruby"
by Sean Cribbs
I’ve teased and toyed with you over the last few days, and finally I’m proud to announce the release of Ripple, a client library and object-mapper for Riak, Basho Technologies’ distributed database.
Since this is a first release, there are a few rough edges, but I think it’s ready enough for the community to start using it.
Two awesome companies, Sonian and Basho, enabled me to spend most of 6 weeks building this library. Many kudos go to them for their financial support and technical direction on hard problems.
For the impatient (or ecstatic) here’s all the Ripple resources:
How this project started
You’ve already read roughly how I came to know about Riak in my first post. Here’s the rest of the story.
In November or December, Tim Dysinger, VP Engineering at Sonian and all-around awesome guy, started expressing his interest in using Riak to back their Ruby apps. Since I was already interested in Riak, I pressed him for a contract to build the Ruby library now known as Ripple, and later Basho signed on as a co-sponsor.
More about the library
The feature list:
- A robust basic client,
- multiple HTTP backends (curb, net/http)
- sensible client defaults (local, default port)
- bucket access and manipulation, including key-streaming
- object reading, storing, deleting and reloading
- automatic de-serialization of JSON, YAML, and Marshal (when given the right content type)
- streaming POST/PUT bodies (when given an IO)
- method-chained map-reduce job construction
- A document-style modeling library,
- ActiveModel 3.0 compatibility
- Property/attribute definition with automatic type-casting
- Bucket selection based on class name, with single-bucket inheritance (configurable)
- Simple finders – all documents, by key
To use Ripple, you need Ruby 1.8.7 or later, and the ActiveModel and ActiveSupport gems from the Rails 3 beta release. Rails 3 will be out very soon, so it might be good to go ahead and get your app ready for it. More details about development and dependencies can be found in the YARD documentation
- Ripple has two namespaces.
require 'riak'to get just the basic client – this should give you parity with the old
jiak.rbincluded in the Riak distribution, plus a lot more niceties.
require 'ripple'to get both the basic client and the (functional but incomplete) object-mapper library.
- You’ll need a working developer setup of Riak 0.8 or later. If you have trouble installing, please ask for help on the mailing list.
- Some of the specs are failing on Ruby 1.9.
- The object-mapper library is incomplete. Most notably missing are associations, which is first on the list to be completed. Work-in-progress is available in the associations branch.
- Using a streaming
allfinder on a
Ripple::Documentwhen using the
curbbackend will render the client unusable because it attempts to request the key reusing the Curl::Easy handle that is doing the streaming. This also affects
Riak::Bucket#keyswith a streaming block, if the user decides to make requests to the server based on the yielded key.
Roadmap and future directions
The heat really turned up this week, partly thanks to my blog posts over the weekend and the changelog podcast, so I felt compelled to release in an incomplete state. In addition to addressing the known issues above, these features are on the docket (all can be seen on the Github issues tracker):
- Identity cache for buckets and keys – think ActiveRecord’s query cache and you’ll know what I mean
ActiveSupport::Cache::Storeimplementation. This is mostly completed in a branch.
ActionControllersession store implementation. Just like the cache store, this should be simple to complete.
- Wide-coverage integration tests and a testing harness. Some cucumber stories would fit the bill here.
- Support parallel backends like Curl::Multi or Typhoeus.
I really enjoyed building this and I hope you enjoy using it in your next Ruby project! Contributions are welcomed!