metron-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (METRON-1771) Update REST endpoints to support eventually consistent UI updates
Date Tue, 11 Sep 2018 16:48:00 GMT


ASF GitHub Bot commented on METRON-1771:

Github user nickwallen commented on a diff in the pull request:
    --- Diff: metron-platform/metron-indexing/src/main/java/org/apache/metron/indexing/dao/
    @@ -309,28 +311,28 @@ public void addCommentToAlert(CommentAddRemoveRequest request, Document
         Document newVersion = new Document(latest);
         newVersion.getDocument().put(COMMENTS_FIELD, commentsMap);
    -    update(newVersion, Optional.empty());
    +    return update(newVersion, Optional.empty());
    -  public void removeCommentFromAlert(CommentAddRemoveRequest request)
    +  public Document removeCommentFromAlert(CommentAddRemoveRequest request)
           throws IOException {
         Document latest = getLatest(request.getGuid(), request.getSensorType());
    -    removeCommentFromAlert(request, latest);
    +    return removeCommentFromAlert(request, latest);
    -  public void removeCommentFromAlert(CommentAddRemoveRequest request, Document latest)
    +  public Document removeCommentFromAlert(CommentAddRemoveRequest request, Document latest)
           throws IOException {
         if (latest == null || latest.getDocument() == null) {
           throw new IOException("Unable to remove comment document that doesn't exist");
         List<Map<String, Object>> commentMap = (List<Map<String, Object>>)
         // Can't remove anything if there's nothing there
         if (commentMap == null) {
    -      return;
    +      return null;
    --- End diff --
    Should we also treat this as an exceptional condition?

> Update REST endpoints to support eventually consistent UI updates
> -----------------------------------------------------------------
>                 Key: METRON-1771
>                 URL:
>             Project: Metron
>          Issue Type: Improvement
>            Reporter: Ryan Merriman
>            Priority: Major
> Currently the REST endpoints that perform document updates either return true/false
or nothing.  This puts the responsibility of retrieving the updated state of the object on
the client in a separate call or optimistically applying the changes and reverting when an
update fails.  This can be problematic if a client attempts to get the current state immediately
after an update and the change isn't visible yet in the back end.
> Ideally they should return the updated state of the object, eliminating the need to
look up the updated state in a separate call.

This message was sent by Atlassian JIRA

View raw message