Skip to content

Move LastBlockMonitor and NodeState out of node module#314

Merged
rustaceanrob merged 1 commit intomasterfrom
further-core-refactor-3-27
Mar 28, 2025
Merged

Move LastBlockMonitor and NodeState out of node module#314
rustaceanrob merged 1 commit intomasterfrom
further-core-refactor-3-27

Conversation

@rustaceanrob
Copy link
Collaborator

The node module is getting cluttered and these are self-contained structures. Doing a bit of a stretch in encapsulation here, but I think since the time we see the last block is implicit to the node network connections, I would like it to be in network. The NodeState is currently very primitive, so I think lib is suitable. If NodeState starts to contain data or methods then it might belong in node again.

The `node` module is getting cluttered and these are self-contained structures.
Doing a bit of a stretch in encapsulation here, but I think since the time we see
the last block is implicit to the node network connections, I would like it to be
in `network`. The `NodeState` is currently very primitive, so I think `lib` is suitable.
If `NodeState` starts to contain data or methods then it might belong in `node` again.
Copy link
Collaborator

@nyonson nyonson left a comment

Choose a reason for hiding this comment

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

ACK 4a08325


/// The state of the node with respect to connected peers.
#[derive(Debug, Clone, Copy)]
pub enum NodeState {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a personal preference so not holding up this patch, but to me NodeState is so specific to node, I would favor keeping it there so that there is clear ownership. Node defines its states. I think this is inline with my general preference to use lib.rs as a "table of contents" which holds very little definitions itself.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I understand that reasoning definitely. It is used as part of the Log message though. If it does gain function in the future, I think it should go back into node for sure.

@rustaceanrob rustaceanrob merged commit 46aa389 into master Mar 28, 2025
12 checks passed
@rustaceanrob rustaceanrob deleted the further-core-refactor-3-27 branch March 28, 2025 16:40
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.

2 participants