You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/01/12 15:07:23 UTC

[GitHub] markusthoemmes commented on a change in pull request #3155: Support ?count on collections

markusthoemmes commented on a change in pull request #3155: Support ?count on collections
URL: https://github.com/apache/incubator-openwhisk/pull/3155#discussion_r161244934
 
 

 ##########
 File path: common/scala/src/main/scala/whisk/core/database/CouchDbRestStore.scala
 ##########
 @@ -329,6 +329,44 @@ class CouchDbRestStore[DocumentAbstraction <: DocumentSerializer](dbProtocol: St
         transid.failed(this, start, s"[QUERY] '$dbName' internal error, failure: '${failure.getMessage}'", ErrorLevel))
   }
 
+  protected[core] def count(table: String, startKey: List[Any], endKey: List[Any], skip: Int, stale: StaleParameter)(
+    implicit transid: TransactionId): Future[Long] = {
+
+    val (realStartKey, realEndKey) = (startKey, endKey)
+    val parts = table.split("/")
+
+    val start = transid.started(this, LoggingMarkers.DATABASE_QUERY, s"[COUNT] '$dbName' searching '$table")
+
+    val f = for (eitherResponse <- client.executeView(parts(0), parts(1))(
 
 Review comment:
   A map would be easier to follow here though.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services