File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff 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
127164export default new AutonomousInfrastructureEvolutionSystem ( ) ;
You can’t perform that action at this time.
0 commit comments