diff --git a/build.sbt b/build.sbt index c22a4dd1..51c424ac 100644 --- a/build.sbt +++ b/build.sbt @@ -31,8 +31,8 @@ val testCleanup = Seq( val sharedSettings = extraSettings ++ ciSettings ++ Seq( organization := "com.twitter", - scalaVersion := "2.10.5", - crossScalaVersions := Seq("2.10.5", "2.11.7"), + scalaVersion := "2.11.7", + crossScalaVersions := Seq("2.10.6", "2.11.7"), javacOptions ++= Seq("-source", "1.6", "-target", "1.6"), javacOptions in doc := Seq("-source", "1.6"), libraryDependencies += "org.scalatest" %% "scalatest" % scalatestVersion % "test", @@ -115,10 +115,10 @@ def youngestForwardCompatible(subProj: String) = .filterNot(unreleasedModules.contains(_)) .map { s => "com.twitter" % ("storehaus-" + s + "_2.10") % "0.12.0" } -val algebirdVersion = "0.11.0" -val bijectionVersion = "0.8.0" +val algebirdVersion = "0.12.0" +val bijectionVersion = "0.9.1" val utilVersion = "6.26.0" -val scaldingVersion = "0.15.1-RC9" +val scaldingVersion = "0.16.0-RC1" val finagleVersion = "6.27.0" val scalatestVersion = "2.2.4" diff --git a/storehaus-hbase/src/main/scala/com/twitter/storehaus/asynchbase/AsyncHBaseLongStore.scala b/storehaus-hbase/src/main/scala/com/twitter/storehaus/asynchbase/AsyncHBaseLongStore.scala index 39cb0f22..df7095e4 100644 --- a/storehaus-hbase/src/main/scala/com/twitter/storehaus/asynchbase/AsyncHBaseLongStore.scala +++ b/storehaus-hbase/src/main/scala/com/twitter/storehaus/asynchbase/AsyncHBaseLongStore.scala @@ -47,26 +47,18 @@ class AsyncHBaseLongStore(protected val quorumNames: Seq[String], protected val threads: Int) extends Store[String, Long] with AsyncHBaseStore { + import com.twitter.bijection.hbase.HBaseInjections.{string2BytesInj, long2BytesInj} /** get a single key from the store. - * Prefer multiGet if you are getting more than one key at a time */ - override def get(k: String): Future[Option[Long]] = { - import com.twitter.bijection.hbase.HBaseBijections._ - implicit val stringInj = fromBijectionRep[String, StringBytes] - implicit val LongInj = fromBijectionRep[Long, LongBytes] - getValue[String, Long](k) - } + override def get(k: String): Future[Option[Long]] = + getValue(k)(string2BytesInj, long2BytesInj) /** * replace a value * Delete is the same as put((k,None)) */ - override def put(kv: (String, Option[Long])): Future[Unit] = { - import com.twitter.bijection.hbase.HBaseBijections._ - implicit val stringInj = fromBijectionRep[String, StringBytes] - implicit val LongInj = fromBijectionRep[Long, LongBytes] - putValue(kv) - } + override def put(kv: (String, Option[Long])): Future[Unit] = + putValue(kv)(string2BytesInj, long2BytesInj) /** Close this store and release any resources. * It is undefined what happens on get/multiGet after close diff --git a/storehaus-hbase/src/main/scala/com/twitter/storehaus/asynchbase/AsyncHBaseStringStore.scala b/storehaus-hbase/src/main/scala/com/twitter/storehaus/asynchbase/AsyncHBaseStringStore.scala index 17c34a3e..3729b3bb 100644 --- a/storehaus-hbase/src/main/scala/com/twitter/storehaus/asynchbase/AsyncHBaseStringStore.scala +++ b/storehaus-hbase/src/main/scala/com/twitter/storehaus/asynchbase/AsyncHBaseStringStore.scala @@ -43,22 +43,19 @@ class AsyncHBaseStringStore(protected val quorumNames: Seq[String], protected val column: String, protected val client: HBaseClient, protected val threads: Int) extends Store[String, String] with AsyncHBaseStore { + import com.twitter.bijection.hbase.HBaseInjections.string2BytesInj /** get a single key from the store. * Prefer multiGet if you are getting more than one key at a time */ - override def get(k: String): Future[Option[String]] = { - import com.twitter.bijection.hbase.HBaseBijections._ - getValue[String, String](k) - } + override def get(k: String): Future[Option[String]] = + getValue(k)(string2BytesInj, string2BytesInj) /** * replace a value * Delete is the same as put((k,None)) */ - override def put(kv: (String, Option[String])): Future[Unit] = { - import com.twitter.bijection.hbase.HBaseBijections._ - putValue(kv) - } + override def put(kv: (String, Option[String])): Future[Unit] = + putValue(kv)(string2BytesInj, string2BytesInj) /** Close this store and release any resources. * It is undefined what happens on get/multiGet after close diff --git a/storehaus-hbase/src/main/scala/com/twitter/storehaus/hbase/HBaseLongStore.scala b/storehaus-hbase/src/main/scala/com/twitter/storehaus/hbase/HBaseLongStore.scala index 683da582..1c91f2c7 100644 --- a/storehaus-hbase/src/main/scala/com/twitter/storehaus/hbase/HBaseLongStore.scala +++ b/storehaus-hbase/src/main/scala/com/twitter/storehaus/hbase/HBaseLongStore.scala @@ -57,26 +57,18 @@ class HBaseLongStore(protected val quorumNames: Seq[String], protected val conf: Configuration, protected val threads:Int) extends Store[String, Long] with HBaseStore { + import com.twitter.bijection.hbase.HBaseInjections.{string2BytesInj, long2BytesInj} /** get a single key from the store. - * Prefer multiGet if you are getting more than one key at a time */ - override def get(k: String): Future[Option[Long]] = { - import com.twitter.bijection.hbase.HBaseBijections._ - implicit val stringInj = fromBijectionRep[String, StringBytes] - implicit val LongInj = fromBijectionRep[Long, LongBytes] - getValue[String, Long](k) - } + override def get(k: String): Future[Option[Long]] = + getValue[String, Long](k)(string2BytesInj, long2BytesInj) /** * replace a value * Delete is the same as put((k,None)) */ - override def put(kv: (String, Option[Long])): Future[Unit] = { - import com.twitter.bijection.hbase.HBaseBijections._ - implicit val stringInj = fromBijectionRep[String, StringBytes] - implicit val LongInj = fromBijectionRep[Long, LongBytes] - putValue(kv) - } + override def put(kv: (String, Option[Long])): Future[Unit] = + putValue(kv)(string2BytesInj, long2BytesInj) /** Close this store and release any resources. * It is undefined what happens on get/multiGet after close diff --git a/storehaus-hbase/src/main/scala/com/twitter/storehaus/hbase/HBaseStore.scala b/storehaus-hbase/src/main/scala/com/twitter/storehaus/hbase/HBaseStore.scala index 55060fd2..44c0a0de 100644 --- a/storehaus-hbase/src/main/scala/com/twitter/storehaus/hbase/HBaseStore.scala +++ b/storehaus-hbase/src/main/scala/com/twitter/storehaus/hbase/HBaseStore.scala @@ -19,7 +19,7 @@ package com.twitter.storehaus.hbase import org.apache.hadoop.hbase.client._ import org.apache.hadoop.conf.Configuration import org.apache.hadoop.hbase.{HColumnDescriptor, HTableDescriptor, HBaseConfiguration} -import com.twitter.bijection.hbase.HBaseBijections._ +import com.twitter.bijection.hbase.HBaseInjections.string2BytesInj import com.twitter.bijection.Conversion._ import com.twitter.bijection.Injection import com.twitter.util.{FuturePool, Future} @@ -71,10 +71,11 @@ trait HBaseStore { val tbl = pool.getTable(table) futurePool { val g = new Get(keyInj(key)) - g.addColumn(columnFamily.as[StringBytes], column.as[StringBytes]) + g.addColumn(string2BytesInj(columnFamily), string2BytesInj(column)) val result = tbl.get(g) - val value = result.getValue(columnFamily.as[StringBytes], column.as[StringBytes]) + val value = result.getValue(string2BytesInj(columnFamily), + string2BytesInj(column)) Option(value).map(v => valueInj.invert(v).get) } ensure tbl.close @@ -85,7 +86,7 @@ trait HBaseStore { kv match { case (k, Some(v)) => futurePool { val p = new Put(keyInj(k)) - p.add(columnFamily.as[StringBytes], column.as[StringBytes], valueInj(v)) + p.add(string2BytesInj(columnFamily), string2BytesInj(column), valueInj(v)) tbl.put(p) } ensure tbl.close diff --git a/storehaus-hbase/src/main/scala/com/twitter/storehaus/hbase/HBaseStringStore.scala b/storehaus-hbase/src/main/scala/com/twitter/storehaus/hbase/HBaseStringStore.scala index ed66d461..4dc8f81e 100644 --- a/storehaus-hbase/src/main/scala/com/twitter/storehaus/hbase/HBaseStringStore.scala +++ b/storehaus-hbase/src/main/scala/com/twitter/storehaus/hbase/HBaseStringStore.scala @@ -56,24 +56,18 @@ class HBaseStringStore(protected val quorumNames: Seq[String], protected val pool: HTablePool, protected val conf: Configuration, protected val threads: Int) extends Store[String, String] with HBaseStore { + import com.twitter.bijection.hbase.HBaseInjections.string2BytesInj /** get a single key from the store. - * Prefer multiGet if you are getting more than one key at a time */ - override def get(k: String): Future[Option[String]] = { - import com.twitter.bijection.hbase.HBaseBijections._ - implicit val stringInj = fromBijectionRep[String, StringBytes] - getValue[String, String](k) - } + override def get(k: String): Future[Option[String]] = + getValue[String, String](k)(string2BytesInj, string2BytesInj) /** * replace a value * Delete is the same as put((k,None)) */ - override def put(kv: (String, Option[String])): Future[Unit] = { - import com.twitter.bijection.hbase.HBaseBijections._ - implicit val stringInj = fromBijectionRep[String, StringBytes] - putValue(kv) - } + override def put(kv: (String, Option[String])): Future[Unit] = + putValue(kv)(string2BytesInj, string2BytesInj) /** Close this store and release any resources. * It is undefined what happens on get/multiGet after close