Skip to content

Conversation

@dmytro-grankin
Copy link
Contributor

@dmytro-grankin dmytro-grankin commented Sep 19, 2017

This PR fixes work of EventStore. Before, EventStore stored redundant data such as enrichments.

Such a behavior could cause performance issues, especially after addition of React annotation.
Because EventContext.origin may contain another EventContext and so on and so on. And every EventContext may contain information about Enrichment of an event.

So from now, EEntity doesn't contain data about the enrichment of the event (which the entity represents), enrichment of the origin (if the origin is EventContext or RejectionContext) and nested origins.

@codecov
Copy link

codecov bot commented Sep 19, 2017

Codecov Report

Merging #581 into master will increase coverage by 0.01%.
The diff coverage is 90.9%.

@@             Coverage Diff              @@
##             master     #581      +/-   ##
============================================
+ Coverage     92.74%   92.76%   +0.01%     
- Complexity     2693     2697       +4     
============================================
  Files           326      326              
  Lines          9290     9311      +21     
  Branches        615      616       +1     
============================================
+ Hits           8616     8637      +21     
  Misses          494      494              
  Partials        180      180

Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comments.

eventStore.append(enriched);
final MemoizingObserver<Event> observer = memoizingObserver();
eventStore.read(EventStreamQuery.getDefaultInstance(), observer);
final RejectionContext modifiedOrigin = observer.responses()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What did you mean by modifiedOrigin? This question applies to this variable and similar below.

final EventContext.Builder resultContext = context.toBuilder()
.clearEnrichment();
final EventContext originEventContext = context.getEventContext();
if (!isDefault(originEventContext)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use case detection API from Protobuf.

@SpineEventEngine SpineEventEngine deleted a comment Sep 19, 2017
Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have default statement with ISE.

Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comments.

// Does nothing because the origins is `null`.
break;
default:
throw newIllegalStateException("Not all of `OriginCase` values were handled.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have the message which says something like “Unsupported origin case encountered: %s”.

break;
case ORIGIN_NOT_SET:
throw newIllegalStateException("EventContext.origin should be set.");
// Does nothing because the origins is `null`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Protofub doesn't have nulls. This comment is misleading.

Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants