tree: 5606b189c7350f8ed4d8ac4d57d6012c8e32d1d3 [path history] [tgz]
  1. project/
  2. scripts/
  3. src/
  4. build.sbt
  5. README.md
scala-client/README.md

pegasus-scala-client

It's built on top of the java client apache/incubator-pegasus/java-client.

Features:

  • Scala friendly.

  • Serialize/deserialize automatically.

Example:

    import org.apache.pegasus.scalaclient.Serializers._

    val c = ScalaPegasusClientFactory.createClient("resource:///pegasus.properties")
   
    // set/get/del
    val hashKey = 12345L
    c.set(table, hashKey, "sort_1", "value_1")
    val value = c.get(table, hashKey, "sort_1").as[String]
    c.del(table, hashKey, "sort_1")
    c.exists(table, hashKey, "sort_1") 
    c.sortKeyCount(table, hashKey)
    
    // multiset/multiget/multidel
    val values = Seq("sort_1" -> "value_1", "sort_2" -> "value_2", "sort_3" -> "value_3")
    val sortKeys = values.unzip._1 
    
    c.multiSet(table, hashKey, values)
    val count = c.sortKeyCount(table, hashKey)
    val multiGetValues = c.multiGet(table, hashKey, sortKeys).as[String]
    val multiGetSortKeys = c.multiGetSortKeys(table, hashKey)
    c.multiDel(table, hashKey, Seq("sort_1", "sort_2"))
    
    c.close