Skip to content

Commit 66b7f6f

Browse files
authored
Update aies.js
1 parent 0c60214 commit 66b7f6f

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/space/aies.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,43 @@ class AutonomousInfrastructureEvolutionSystem {
122122
this.logger.info(`Repair interval updated to: ${this.repairInterval} ms`);
123123
}
124124
}
125+
126+
// Method to register a node created by SRNF
127+
registerNode(node) {
128+
if (!node || !node.id) {
129+
throw new Error('Invalid node data for registration.');
130+
}
131+
132+
// Check if the network is at capacity
133+
if (this.nodeNetwork.length >= this.nodeCapacity) {
134+
this.logger.warn("Node capacity reached. Cannot register new node.");
135+
return;
136+
}
137+
138+
this.nodeNetwork.push(node);
139+
this.logger.info(`Node registered: ${JSON.stringify(node)}`);
140+
}
141+
142+
// Method to update the status of a registered node
143+
updateNodeStatus(nodeId, status) {
144+
const node = this.nodeNetwork.find(n => n.id === nodeId);
145+
if (!node) {
146+
throw new Error('Node not found.');
147+
}
148+
149+
node.status = status;
150+
this.logger.info(`Node status updated: ${nodeId} is now ${status}`);
151+
}
152+
153+
// Method to get information about a specific node
154+
getNodeInfo(nodeId) {
155+
const node = this.nodeNetwork.find(n => n.id === nodeId);
156+
if (!node) {
157+
throw new Error('Node not found.');
158+
}
159+
160+
return node;
161+
}
125162
}
126163

127164
export default new AutonomousInfrastructureEvolutionSystem();

0 commit comments

Comments
 (0)