openwhisk-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] rabbah commented on a change in pull request #3709: Inlined attachments
Date Tue, 05 Jun 2018 23:37:24 GMT
rabbah commented on a change in pull request #3709: Inlined attachments
URL: https://github.com/apache/incubator-openwhisk/pull/3709#discussion_r192448176
 
 

 ##########
 File path: common/scala/src/main/scala/whisk/core/database/CouchDbRestStore.scala
 ##########
 @@ -356,13 +356,21 @@ class CouchDbRestStore[DocumentAbstraction <: DocumentSerializer](dbProtocol:
St
     docStream: Source[ByteString, _],
     oldAttachment: Option[Attached])(implicit transid: TransactionId): Future[(DocInfo, Attached)]
= {
 
-    val attachmentUri = Uri.from(scheme = attachmentScheme, path = UUID().asString)
-    val attached = Attached(attachmentUri.toString(), contentType)
-    val updatedDoc = update(d, attached)
-
     for {
-      i1 <- put(updatedDoc)
-      i2 <- attach(i1, attachmentUri.path.toString(), attached.attachmentType, docStream)
+      (bytes, tailSource) <- inlineAndTail(docStream)
+      uri <- Future.successful(uriOf(bytes, UUID().asString))
+      attached <- {
+        val a = if (isInlined(uri)) {
+          Attached(uri.toString(), contentType, Some(bytes.size), Some(digest(bytes)))
 
 Review comment:
   may omit `()` on `toString`.

----------------------------------------------------------------
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

Mime
View raw message