Stabilize Node interface #3

Closed
opened 2026-04-21 14:56:30 +00:00 by linarphy · 2 comments
Owner

Implements two states for Node.

Implements two states for Node.
linarphy added the due date 2026-04-26 2026-04-21 15:02:53 +00:00
Author
Owner

After careful thought, I think I should implement an architecture where a Node can be Offline or Online, which change their behaviors and states. A Node which is Online is attached to a graph, and can be disconnected. An Offline Node is not attached to a graph and can be connected.

Here, I have two choice:

  • Have a Node class with behavior that do not depends of graph existence, an OfflineNode class that inherit from Node and another OnlineNode class that also inherit from Node.
  • Have a Node class that contains a state property, of class NodeState. A property of NodeState is online, which is an object of the OnlineState class ( IsOffline and IsOnline classes inherit from OnlineState). A Node state can change (for example) from offline to online with method like Node.connect which call node.state.offline.connect.
After careful thought, I think I should implement an architecture where a Node can be Offline or Online, which change their behaviors and states. A Node which is Online is attached to a graph, and can be disconnected. An Offline Node is not attached to a graph and can be connected. Here, I have two choice: - Have a Node class with behavior that do not depends of graph existence, an OfflineNode class that inherit from Node and another OnlineNode class that also inherit from Node. - Have a Node class that contains a state property, of class NodeState. A property of NodeState is online, which is an object of the OnlineState class ( IsOffline and IsOnline classes inherit from OnlineState). A Node state can change (for example) from offline to online with method like Node.connect which call node.state.offline.connect.
Author
Owner

I have chosen the last option, and have also applied it to Connection. Now updating tests.

I have chosen the last option, and have also applied it to Connection. Now updating tests.
Sign in to join this conversation.
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

2026-04-26

Blocks
#1 Add a reference API
linarphy/galaxy-graph
Reference
linarphy/galaxy-graph#3
No description provided.