riak-scala-client is a Scala client library for Riak based on Akka and Spray. It aims to be easy to use, non-blocking, and fast, in that order.

Supported Riak API

  • Fetch
  • Store
  • Delete
  • Secondary Indexes (2i)
  • Getting/setting bucket properties
  • Ping

Features

  • Completely non-blocking thanks to Scala 2.10 Futures, Akka and Spray
  • Transparent integration with Akka projects through an Akka extension
  • An untyped RiakValue class for interacting with raw Riak values and their associated meta data (vclock, etag, content type, last modified time, indexes, etc.)
  • A typed RiakMeta[T] class for interacting with deserialized values while retaining their associated meta data (vclock, etag, content type, last modified time, indexes, etc.)
  • Customizable conflict resolution on all fetches (and stores when returnbody=true)
  • Automatic (de)serialization of Scala (case) classes using type classes
  • Builtin default spray-json (de)serializers
  • Customizable indexing of Scala (case) classes using type classes
  • Auto-retry of fetches and stores (a standard feature of the underlying spray-client library)

This project was started in December 2012 out of frustration about the (then) lack of non-blocking Scala (or Java) client libraries for Riak. The first public version (0.8.0) was released in March 2013 after several early beta releases were tested internally to get feedback from external users on a commercial project. The current version is 0.8.1.1.

riak-scala-client has been tested on single machine Riak installations and small(ish) clusters of up to 7 nodes. There might be some minor API changes on the way towards 1.0 but things should be pretty stable overall. So please go ahead and try it out or even battle test it in production as long as you are aware that the paint is still drying.

Getting Started

riak-scala-client is available from the Maven Central and Sontatype Releases repositories. The current version is 0.8.1.1 and currently it is only available for Scala 2.10.x.

You can add riak-scala-client to your SBT project by including the following dependency:

libraryDependencies += "com.scalapenos" %% "riak-scala-client" % 0.8.1.1

Or if you prefer Maven, you can add riak-scala-client to your Maven project by including the following dependency:

<dependency>
  <groupId>com.scalapenos</groupId>
  <artifactId>riak-scala-client_2.10</artifactId>
  <version>0.8.1.1</version>
</dependency>

Next, head on over to the documentation section, which describes everything else you need to get started.

Coming Soon

The following Riak API features still have to be implemented:

  • Meta Properties
  • Link Walking
  • Map Reduce
  • Listing all keys in a bucket
  • Listing all buckets
  • Conditional fetch/store semantics (i.e. If-None-Match and If-Match for ETags and If-Modified-Since and If-Unmodified-Since for LastModified)
  • Riak Node Status

Other things that are on the roadmap for 1.0:

  • Using Play Iteratees for all API methods that return multiple values
  • Implement streaming http response handling for all API methods that return multiple values
  • Implement some micro-benchmarks to compare performance with other current Scala/Java clients

If you think anything is missing from the above lists, please go ahead and let us know by creating an issue or a pull request!

Feedback Welcome!

Feedback is always good so please go ahead and fork the project, file issues (or complaints), create pull requests, star the project on GitHub, or loudly proclaim your (dis)approval on a mailing list of your choice (riak-users would be a good one to start with).

License

This project is licensed under the Apache 2.0 open source license.