start method

  1. @override
Future<void> start()

Returns a Future that completes when the BlockStore and its pin manager have started.

Implementation

@override
/// Returns a [Future] that completes when the [BlockStore] and its pin manager have started.
Future<void> start() async {
  _logger.debug('Starting BlockStore at $path...');
  try {
    await _initializeStorage();

    // Load pin state
    final pinsFile = p.join(path, 'pins.json');
    await _pinManager.load(pinsFile);

    _logger.debug(
      'BlockStore started successfully with ${_blockIndex.length} blocks',
    );
  } catch (e, stackTrace) {
    _logger.error('Failed to start BlockStore', e, stackTrace);
    rethrow;
  }
}