Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Data structures for Cassandra

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 HISTORY.md
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 sexyback.gemspec
README.md

Sexy Back

I'm bringin' sexy back
Them other boys don't know how to act
I think it's special what's behind your back
So turn around and I'll pick up the slack
(Take 'em to the bridge)

OK, so here we are, at the bridge. Is sexyback just another mildly offensive Ruby gem? Awww hell no! sexyback makes using Cassandra really, well, awesomer.

Like JT, sexyback thinks it's special what's behind your back...end, per se. Cassandra has a neat data model that is horribly explained in most docs. But if you think about it in terms of the data structures that you can implement in Cassandra, it's pretty rad.

A further similarity to Justin Timberlake, sexyback picks up the slack. It gives you a library of nifty data structures that you can work with in Cassandra. Most of them guarantee atomic operations; others require a lock and multiple writes to do their nifty thing.

Show me what you got

It's a bit rough at this point, but here's a hash that is stored into a Cassandra row.

Sexyback::Hash.connection = Cassandra.new('SomeKeyspace')
Sexyback::Hash.column_family = :Hash

hsh = Sexyback::Hash.new
hsh.row_key = 'example'
hsh.set('alice', 'bob')
hsh.set('bob', 'charlie')
hsh.set('charlie', 'alice')
hsh.get_all # => {'alice' => 'bob', 'bob' => 'charlie', 'charlie' => 'alice'} 

The bits where connection and column_family are global are obviously crap, but hopefully the other bits are interesting.


Everything above this line is hot air and everything below this line is ambition. Don't judge me.

The sexy

Atomic types:

  • Hash
  • Set
  • Sorted Set (TODO)
  • Append-only list (TODO)
  • Lock (TODO)
  • Scoreboard (TODO)

TODO: copy everything from redback TODO: Redis duck-type compatible driver-esque object

The data model

  • How to set the keyspace and column family in use?
  • When to use a different column family?
  • How to configure sexyback for your app?
  • Example usage of the simple data structure?

License

Copyright 2011 Adam Keys. Sexyback is MIT licensed.

Something went wrong with that request. Please try again.