-
Notifications
You must be signed in to change notification settings - Fork 269
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
Add PeerTableModel::StatsRole to prevent data layer violation #161
Conversation
Reworked from scratch. |
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.
Light ACK 4c05fe0 with the caveat that I don't know the qt framework or this code well. Saw no regression while manually testing. A few suggestions below to aid in reading and understanding the code.
This change allows access to CNodeCombinedStats instance directly from any view object.
This change prevents direct calls to the PeerTableModel object that is a layer violation.
Updated 4c05fe0 -> b3e9bca (pr161.02 -> pr161.03):
|
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.
Tested re-ACK b3e9bca per git range-diff ae8f797 4c05fe0 b3e9bca
Thanks for updating.
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.
Code review ACK b3e9bca.
As follow ups, maybe it could make sense to split each member of
struct CNodeCombinedStats {
CNodeStats nodeStats;
CNodeStateStats nodeStateStats;
bool fNodeStateStatsAvailable;
};
on a dedicated role.
Or just add some other roles like:
- const auto stats = peer.data(PeerTableModel::StatsRole).value<CNodeCombinedStats*>();
- cachedNodeids.append(stats->nodeStats.nodeid);
+ cachedNodeids.append(peer.data(PeerTableModel::NodeIdRole).toInt());
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.
utACK b3e9bca
…data layer violation b3e9bca qt, refactor: Drop no longer used PeerTableModel::getNodeStats function (Hennadii Stepanov) 49c6040 qt: Use PeerTableModel::StatsRole (Hennadii Stepanov) 35007ed qt: Add PeerTableModel::StatsRole (Hennadii Stepanov) Pull request description: This PR allows to access to the `CNodeCombinedStats` instance directly from any view object. The `PeerTableModel::getNodeStats` member function removed as a kind of layer violation. No behavior changes. Also other pulls (bugfixes) are based on this one: #18 and #164. ACKs for top commit: jonatack: Tested re-ACK b3e9bca per `git range-diff ae8f797 4c05fe0 b3e9bca` promag: Code review ACK b3e9bca. jonasschnelli: utACK b3e9bca Tree-SHA512: 6ba50d5dd2c0373655d491ce8b130c47d598da2db5ff4b00633f447404c7e70f8562ead53ddf166e851384d9632ff9146a770c99845c2cdd3ff7250677e4c130
This PR allows to access to the
CNodeCombinedStats
instance directly from any view object.The
PeerTableModel::getNodeStats
member function removed as a kind of layer violation.No behavior changes.
Also other pulls (bugfixes) are based on this one: #18 and #164.