Github user nickwallen commented on a diff in the pull request:
https://github.com/apache/metron/pull/1190#discussion_r216733487
--- Diff:
metron-platform/metron-indexing/src/main/java/org/apache/metron/indexing/dao/MultiIndexDao.java
---
@@ -121,20 +131,30 @@ public void addCommentToAlert(CommentAddRemoveRequest
request, Document latest)
if (exceptions.size() > 0) {
throw new IOException(Joiner.on("\n").join(exceptions));
}
+ return newVersions.get(0);
}
@Override
- public void removeCommentFromAlert(CommentAddRemoveRequest request)
throws IOException {
+ public Document removeCommentFromAlert(CommentAddRemoveRequest request)
throws IOException {
Document latest = getLatest(request.getGuid(),
request.getSensorType());
- removeCommentFromAlert(request, latest);
+ return removeCommentFromAlert(request, latest);
}
+ /**
+ * Removes comments from an alert. Updates are written to each Dao in
parallel with the assumption that all updates
+ * are identical. The first update to be applied is returned as the
current version of the alert with comments removed.
+ * @param request Request to remove comments
+ * @param latest The latest version of the alert the comments will be
removed from.
+ * @return The complete alert document with comments removed.
+ * @throws IOException
+ */
@Override
- public void removeCommentFromAlert(CommentAddRemoveRequest request,
Document latest) throws IOException {
+ public Document removeCommentFromAlert(CommentAddRemoveRequest request,
Document latest) throws IOException {
+ final List<Document> newVersions = new ArrayList<>();
--- End diff --
Same here... If we do it this way, we just need to make this a thread-safe
list.
---