[GitHub] rabbah commented on a change in pull request #3366: Adds method deleteAttachments to ArtifactStore
rabbah commented on a change in pull request #3366: Adds method deleteAttachments to ArtifactStore URL: https://github.com/apache/incubator-openwhisk/pull/3366#discussion_r172757550 ## File path: common/scala/src/main/scala/whisk/core/entity/WhiskAction.scala ## @@ -376,6 +376,24 @@ object WhiskAction extends DocumentFactory[WhiskAction] with WhiskEntityQueries[ } } + override def del[Wsuper >: WhiskAction](db: ArtifactStore[Wsuper], doc: DocInfo)( +implicit transid: TransactionId, +notifier: Option[CacheChangeNotification]): Future[Boolean] = { +Try { + require(db != null, "db undefined") + require(doc != null, "doc undefined") +}.map { _ => + val fa = super.del(db, doc) + implicit val ec = db.executionContext + fa.flatMap { _ => +super.deleteAttachments(db, doc) Review comment: Thinking strictly about an action, today you?d know what based on the exec type and attached details. Eventually we will store all blobs as attachments so it may be inconsequential. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] rabbah commented on a change in pull request #3366: Adds method deleteAttachments to ArtifactStore
rabbah commented on a change in pull request #3366: Adds method deleteAttachments to ArtifactStore URL: https://github.com/apache/incubator-openwhisk/pull/3366#discussion_r172620716 ## File path: common/scala/src/main/scala/whisk/core/entity/WhiskAction.scala ## @@ -376,6 +376,24 @@ object WhiskAction extends DocumentFactory[WhiskAction] with WhiskEntityQueries[ } } + override def del[Wsuper >: WhiskAction](db: ArtifactStore[Wsuper], doc: DocInfo)( +implicit transid: TransactionId, +notifier: Option[CacheChangeNotification]): Future[Boolean] = { +Try { + require(db != null, "db undefined") + require(doc != null, "doc undefined") +}.map { _ => + val fa = super.del(db, doc) + implicit val ec = db.executionContext + fa.flatMap { _ => +super.deleteAttachments(db, doc) Review comment: as a future enhancement this could be done only when there is an attachment present and this code possibly merged into the document factory instead. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] rabbah commented on a change in pull request #3366: Adds method deleteAttachments to ArtifactStore
rabbah commented on a change in pull request #3366: Adds method deleteAttachments to ArtifactStore URL: https://github.com/apache/incubator-openwhisk/pull/3366#discussion_r171841899 ## File path: common/scala/src/main/scala/whisk/core/database/ArtifactStore.scala ## @@ -129,6 +129,11 @@ trait ArtifactStore[DocumentAbstraction] { protected[core] def readAttachment[T](doc: DocInfo, name: String, sink: Sink[ByteString, Future[T]])( implicit transid: TransactionId): Future[(ContentType, T)] + /** + * Deletes an attachments linked to given document + */ + protected[core] def deleteAttachments[T](doc: DocInfo)(implicit transid: TransactionId): Future[Boolean] Review comment: > + * Deletes an attachments linked to given document -> Deletes all attachments linked to a given document. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] rabbah commented on a change in pull request #3366: Adds method deleteAttachments to ArtifactStore
rabbah commented on a change in pull request #3366: Adds method deleteAttachments to ArtifactStore URL: https://github.com/apache/incubator-openwhisk/pull/3366#discussion_r171842936 ## File path: common/scala/src/main/scala/whisk/core/database/CouchDbRestStore.scala ## @@ -456,6 +456,11 @@ class CouchDbRestStore[DocumentAbstraction <: DocumentSerializer](dbProtocol: St ErrorLevel)) } + override protected[core] def deleteAttachments[T](doc: DocInfo)(implicit transid: TransactionId): Future[Boolean] = +//For CouchDB attachments lifecycle is tied to document. So if the Review comment: I prefer a stronger warning here: ``` // NOTE: this method is not intended for standalone use for CouchDB. // To delete attachments, it is expected that the entire document is deleted. ``` 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: us...@infra.apache.org With regards, Apache Git Services