class RocksDBKeyValueStorageFactory implements KeyValueStorageFactory {

  @Override
  public KeyValueStorage create(
      final SegmentIdentifier segment,
      final BesuConfiguration commonConfiguration,
      final MetricsSystem metricsSystem)
      throws StorageException {

    if (requiresInit()) {
      init(commonConfiguration);
    }

    // It's probably a good idea for the creation logic to be entirely dependent on the database
    // version. Introducing intermediate booleans that represent database properties and dispatching
    // creation logic based on them is error prone.
    switch (databaseVersion) {
      case 0:
        {
          segmentedStorage = null;
          if (unsegmentedStorage == null) {
            unsegmentedStorage =
                new RocksDBKeyValueStorage(
                    rocksDBConfiguration, metricsSystem, rocksDBMetricsFactory);
          }
          return unsegmentedStorage;
        }
      case 1:
        {
          unsegmentedStorage = null;
          if (segmentedStorage == null) {
            segmentedStorage =
                new RocksDBColumnarKeyValueStorage(
                    rocksDBConfiguration, segments, metricsSystem, rocksDBMetricsFactory);
          }
          return new SegmentedKeyValueStorageAdapter<>(segment, segmentedStorage);
        }
      default:
        {
          throw new IllegalStateException(
              String.format(
                  "Developer error: A supported database version (%d) was detected but there is no associated creation logic.",
                  databaseVersion));
        }
    }
  }

    RocksDBKeyValueStorageFactory(
      final Supplier<RocksDBFactoryConfiguration> configuration,
      final List<SegmentIdentifier> segments,
      final int defaultVersion,
      final RocksDBMetricsFactory rocksDBMetricsFactory);
  public  RocksDBKeyValueStorageFactory(
      final Supplier<RocksDBFactoryConfiguration> configuration,
      final List<SegmentIdentifier> segments,
      final RocksDBMetricsFactory rocksDBMetricsFactory);

}