-
Notifications
You must be signed in to change notification settings - Fork 242
Move definitions of datatypes and tokens to their proper namespace #312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Nicko Guyer <[email protected]>
internal/events/aggregator.go
Outdated
| eventType := fftypes.EventTypeMessageConfirmed | ||
| switch { | ||
| case msg.Header.Namespace == fftypes.SystemNamespace: | ||
| case msg.Header.Namespace == fftypes.SystemNamespace || msg.Header.Type == fftypes.MessageTypeDefinition: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does syshandler now handle anything that is not a definition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's only ever handled definitions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it needs a different name 🙃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And maybe the first part of the if clause here is irrelevant...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly. Probably worth some input from @peterbroadhurst on this one. I'll try to chat with him when he gets a chance. The rest of the code, including the unit tests seem to be written in a way that assumes there could be system broadcasts that are not definitions. Maybe there is a case I'm not thinking about, possibly a future case. Or maybe the way the code was originally written is not relevant anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I've approved since I think these changes are good - but probably need to have a chat about the future of what else may be on the ff_system namespace, and if "syshandler" is really the right name for the thing that is handling definitions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peterbroadhurst I removed the first part of this case in the switch statement, which did change some failure code paths in the tests. I'll highlight those in the places that changed. But would appreciate your eyes on this to make sure the correct thing is still happening here.
Signed-off-by: Nicko Guyer <[email protected]>
Signed-off-by: Nicko Guyer <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #312 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 232 234 +2
Lines 12720 12788 +68
=========================================
+ Hits 12720 12788 +68
Continue to review full report at Codecov.
|
internal/events/aggregator_test.go
Outdated
| mdm.On("ValidateAll", ag.ctx, mock.Anything).Return(false, nil) | ||
|
|
||
| dbm := ag.database.(*databasemocks.Plugin) | ||
| dbm.On("UpdateMessage", ag.ctx, mock.Anything, mock.Anything).Return(nil) | ||
| dbm.On("InsertEvent", ag.ctx, mock.Anything).Return(errors.Errorf("pop")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peterbroadhurst This is one of the tests I had to change
| msh := ag.syshandlers.(*syshandlersmocks.SystemHandlers) | ||
| msh.On("HandleSystemBroadcast", mock.Anything, mock.Anything, mock.Anything).Return(false, nil) | ||
|
|
||
| mdm := ag.data.(*datamocks.Manager) | ||
| mdm.On("GetMessageData", ag.ctx, mock.Anything, true).Return([]*fftypes.Data{}, true, nil) | ||
|
|
||
| mdm.On("ValidateAll", ag.ctx, mock.Anything).Return(false, nil) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peterbroadhurst This is one of the tests I had to change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to check, why wouldn't you just change msh := ag.syshandlers.(*syshandlersmocks.SystemHandlers) to be the DefinitionHandlers, and return false and set Header.Type on the message in attemptMessageDispatch?
e.g. so you're testing the same path.
| eventType := fftypes.EventTypeMessageConfirmed | ||
| switch { | ||
| case msg.Header.Namespace == fftypes.SystemNamespace: | ||
| case msg.Header.Type == fftypes.MessageTypeDefinition: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks right to me 👍
Think this is the substantial change, matching the package rename.
We went from "If it's on the system namespace, the system handlers handle it"...
To "If it's a definition, then the definition handlers handle it"
Signed-off-by: Nicko Guyer <[email protected]>
Signed-off-by: Nicko Guyer <[email protected]>
Signed-off-by: Nicko Guyer <[email protected]>
|
Re-running the build because it failed due to this bug: #265 |
1 similar comment
|
Re-running the build because it failed due to this bug: #265 |
| return dh.handleTokenPoolBroadcast(ctx, msg, data) | ||
| default: | ||
| l.Warnf("Unknown topic '%s' for system broadcast ID '%s'", msg.Header.Tag, msg.Header.ID) | ||
| l.Debugf("Unknown topic '%s' for system broadcast or definition ID '%s'", msg.Header.Tag, msg.Header.ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really only for definitions now, right? The "or" seems superfluous. Also we say "topic" but actually log the "tag".
internal/events/aggregator.go
Outdated
| switch { | ||
| case msg.Header.Namespace == fftypes.SystemNamespace: | ||
| case msg.Header.Type == fftypes.MessageTypeDefinition: | ||
| // We handle system events in-line on the aggregator, as it would be confusing for apps to be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"system events" is now more accurately "definition events"
awrichar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New changes look great. Noted a few spelling items in logs/comments.
Signed-off-by: Nicko Guyer <[email protected]>
Signed-off-by: Nicko Guyer <[email protected]>
|
Looks good, thanks for making those adjustments. |
Messages that use the
ff_systemnamespace:Messages that use whatever namespace is specified in the API request path: