Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Operações básicas com riak usando scala
import scala.collection.JavaConverters._
import com.basho.riak.client.bucket.Bucket
import org.json.JSONObject
class HashWrapper(private var bucket:Bucket) {
def name():String = bucket.getName
def keys(): Iterator[String] = bucket.keys().iterator.asScala
def store(key:String, value:String): String = {[String](key, value).execute()
def delete(key:String) = {
def fetch(key:String): JSONObject = {
var retorno:JSONObject = new JSONObject()
val riakObject = bucket.fetch(key).execute()
if (riakObject != null) retorno = new JSONObject( riakObject.getValueAsString )
object HashWrapper {
def buildTableWrapper(bucket:Bucket): HashWrapper = new HashWrapper( bucket )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment