Final tweaks to common KVStorageBackend factored out of Riak and Voldemort backends
This commit is contained in:
parent
c00aef3591
commit
7b56928bca
2 changed files with 17 additions and 15 deletions
|
|
@ -45,7 +45,7 @@ private[akka] trait KVStorageBackend extends MapStorageBackend[Array[Byte], Arra
|
|||
val vectorSizeIndex = getIndexedBytes(-1)
|
||||
val queueHeadIndex = getIndexedBytes(-1)
|
||||
val queueTailIndex = getIndexedBytes(-2)
|
||||
//explicit implicit :)
|
||||
|
||||
implicit val ordering = ArrayOrdering
|
||||
import KVAccess._
|
||||
|
||||
|
|
|
|||
|
|
@ -25,9 +25,24 @@ private[akka] object RiakStorageBackend extends KVStorageBackend {
|
|||
val clientHost = config.getString("akka.storage.riak.client.host", "localhost")
|
||||
val clientPort = config.getInt("akka.storage.riak.client.port", 8087)
|
||||
val riakClient: RiakClient = new RiakClient(clientHost, clientPort);
|
||||
|
||||
import KVAccess._
|
||||
import RiakAccess._
|
||||
|
||||
|
||||
val refs = new RiakAccess(refBucket)
|
||||
val maps = new RiakAccess(mapBucket)
|
||||
val vectors = new RiakAccess(vectorBucket)
|
||||
val queues = new RiakAccess(queueBucket)
|
||||
|
||||
def refAccess = refs
|
||||
|
||||
def mapAccess = maps
|
||||
|
||||
def vectorAccess = vectors
|
||||
|
||||
def queueAccess = queues
|
||||
|
||||
object RiakAccess {
|
||||
implicit def byteArrayToByteString(ary: Array[Byte]): ByteString = {
|
||||
ByteString.copyFrom(ary)
|
||||
|
|
@ -79,7 +94,7 @@ private[akka] object RiakStorageBackend extends KVStorageBackend {
|
|||
|
||||
def getAll(keys: Iterable[Array[Byte]]): Map[Array[Byte], Array[Byte]] = {
|
||||
var result = new HashMap[Array[Byte], Array[Byte]]
|
||||
keys.foreach {
|
||||
keys.foreach{
|
||||
key =>
|
||||
val value = getValue(key)
|
||||
Option(value) match {
|
||||
|
|
@ -103,18 +118,5 @@ private[akka] object RiakStorageBackend extends KVStorageBackend {
|
|||
}
|
||||
}
|
||||
|
||||
val refs = new RiakAccess(refBucket)
|
||||
val maps = new RiakAccess(mapBucket)
|
||||
val vectors = new RiakAccess(vectorBucket)
|
||||
val queues = new RiakAccess(queueBucket)
|
||||
|
||||
def refAccess = refs
|
||||
|
||||
def mapAccess = maps
|
||||
|
||||
def vectorAccess = vectors
|
||||
|
||||
def queueAccess = queues
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue