stop method
Returns a Future that completes when the IPFS node has stopped gracefully, releasing all resources.
Transitions the state from NodeState.running to NodeState.stopped.
Throws NodeShutdownError if any critical subsystem fails to stop.
Implementation
Future<void> stop() async {
if (_state == NodeState.stopped || _state == NodeState.stopping) {
_logger.warning('Node is already ${_state.name}');
return;
}
_state = NodeState.stopping;
_logger.info('Stopping IPFS Node...');
try {
await _pluginManager.stopAll();
await _lifecycleManager.stopAll();
_state = NodeState.stopped;
_logger.info('IPFS Node stopped successfully');
} catch (e, stackTrace) {
_state = NodeState.error;
_logger.error('Failed to stop IPFS Node', e, stackTrace);
throw NodeShutdownError('Failed to stop IPFS node', details: e);
}
}