fauna / cassandra

A Ruby client for the Cassandra distributed database.

This URL has Read+Write access

ryanking (author)
Mon Nov 09 11:15:58 -0800 2009
commit  adf0ccbfc4ee7ebe4ad69d403b8f14d8aefa8e18
tree    7070b062c24c046ac8dcfbb98c3d2c89273f924a
parent  56f4d6616da4c18b448d509010b604508c5d75ff
name age message
file .gitignore Tue Aug 18 13:17:37 -0700 2009 Handy script to install the server. [Evan Weaver]
file CHANGELOG Tue Oct 13 23:20:05 -0700 2009 Use thriftclient. [Evan Weaver]
file LICENSE Tue Jun 30 10:06:07 -0700 2009 License. [Evan Weaver]
file Manifest Tue Oct 13 21:59:55 -0700 2009 No safeclient. [Evan Weaver]
file README Thu Aug 20 17:20:36 -0700 2009 Re-use same checkout folder from now on. [Evan Weaver]
file Rakefile Loading commit data...
directory bin/ Tue Aug 18 13:17:37 -0700 2009 Handy script to install the server. [Evan Weaver]
directory conf/ Mon Nov 09 11:15:58 -0800 2009 switch to github account for upstream server [ryanking]
directory lib/
directory test/
directory vendor/
README
cassandra

A Ruby client for the Cassandra distributed database. 

== License

Copyright 2009 Twitter, Inc. See included LICENSE file. Portions copyright 2004-2009 David Heinemeier Hansson, and used 
with permission.

The public certificate for this gem is 
here[http://rubyforge.org/frs/download.php/25331/evan_weaver-original-public_cert.pem]. 

== Features

* clean encapsulation of the Thrift API
* compatible UUID and Long classes, for GUID generation
* Ruby 1.9 compatibility

The Github source repository is {here}[http://github.com/fauna/cassandra/]. Patches and contributions are very welcome.

== Installation

You need Ruby 1.8 or 1.9. If you have those, just run:

  sudo gem install cassandra
  
Cassandra itself is a rapidly moving target. In order to get a working server, use the <tt>bin/cassandra_helper</tt> 
script:

  cassandra_helper cassandra
  
A server will be installed in <tt>$HOME/cassandra/server</tt>, and started in debug mode.

== Usage
  
Now, start IRb and require the library:
  
  require 'cassandra'
  
Connect to a server and keyspace:
  
  client = Cassandra.new('Twitter', "127.0.0.1")
  
Insert into a column family. You can insert a Cassandra::OrderedHash, or a regular Hash, if order doesn't matter:

  client.insert(:Users, "5", {'screen_name' => "buttonscat"})  

Insert into a super column family:

  client.insert(:UserRelationships, "5", {"user_timeline" => {UUID.new => "1"}})

Query a super column:

  timeline = client.get(:UserRelationships, "5", "user_timeline")
  
The returned result will always be a Cassandra::OrderedHash.

See Cassandra for more methods.

== Further reading

* {Up and Running With Cassandra}[http://blog.evanweaver.com/articles/2009/07/06/up-and-running-with-cassandra]

== Reporting problems

The Github issue tracker is {here}[http://github.com/fauna/cassandra/issues]. If you have problems with Cassandra 
itself, please use the {cassandra-user mailing 
list}[http://mail-archives.apache.org/mod_mbox/incubator-cassandra-user/].