start method

Future<void> start()

Returns a Future that completes when the IPFS node and all its subsystems have started.

Transitions the state from NodeState.stopped to NodeState.running. Throws NodeStateError if the node is already running or starting. Throws NodeStartupError if any critical subsystem fails to start.

Implementation

Future<void> start() async {
  if (_state == NodeState.running || _state == NodeState.starting) {
    throw NodeStateError('Node is already ${_state.name}');
  }

  _state = NodeState.starting;
  _logger.info('Starting IPFS Node...');

  try {
    await _lifecycleManager.startAll();
    await _mfsManager.init();
    await _pluginManager.initAll();
    await _pluginManager.startAll();
    _state = NodeState.running;
    _logger.info('IPFS Node started successfully');
  } catch (e, stackTrace) {
    _state = NodeState.error;
    _logger.error('Failed to start IPFS Node', e, stackTrace);
    throw NodeStartupError('Failed to start IPFS node', details: e);
  }
}