Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A Grails plugin for Cassandra 0.7
Groovy Gosu Java
tree: fa5e6908c2

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.settings
grails-app
lib
scripts
test/unit/codehead
web-app/WEB-INF
.classpath
.project
CassandraGrailsPlugin.groovy
LICENSE.txt
README
application.properties
plugin.xml

README

http://www.opensource.org/licenses/apache2.0.php

Cassandra Version: 0.5.1
Hector Version: 0.5.0-6
Grails: 1.2.1



DISCLAIMER: NOT READY FOR PRIME TIME!

This code is still highly in development. Expect lots of changes. When the 
code is considered stable, this disclaimer will be removed.



ABOUT

This grails plugins provides a service to enable easy access to Cassandra
from within grails. It is not intended to be a GORM mapping layer.

It specifically wraps the Hector (http://github.com/rantav/hector) API which
makes it easy to connect to Cassandra without dealing with the thrift layer.
Hector also provides for connection pooling, etc.

Goals:

Primary goals of this project is to have a service that provides easy access
to Cassandra. This includes simplify lookup and setting of Cassandra values,
and optionally hiding 'NotFound' exceptions. (The ruby Cassandra plugin 
returns an empty hash if a searched for value does not exist. Java plugin
throws an exception.)

Usage:

By default, this plugin will connect to Cassandra running at localhost:9160
using the keyspace 'Keyspace1' for all queries. To change this, setup in
your grails-app/conf/spring/resources.groovy file:

beans = {
        cassandraService(codehead.CassandraService){
            servers=["localhost:9160","192.168.2.1:9160"] 
            defaultKeyspace="GeneralKeyspace"
        }
}

The above configuration will allow for server fail-over to multiple Cassandra
servers running, and default requests to the 'GeneralKeyspace' named Keyspace.



EXAMPLES

import java.util.Date
class CassandraLookupController {
    def cassandraService
    def index = {
        def now = new Date().toString()
        def old_value = cassandraService.setColumnPathValue("Users","login_date","2",now)
        def new_value = cassandraService.columnPathValue("Users","login_date","2")
        def str = "Login date was $old_value and now is $new_value"
        render(str)
    }
}


TODO
Some tasks in progress
  - Make use of super columns
  - Simplify default access pattern more
  - Create CassandraHashMap that can use supercolumns



THANKS

Thanks to iMemories for allowing me to open-source this code.  

Something went wrong with that request. Please try again.