private static VersionedStorageFormat fromV2(final MetadataV2 metadataV2) {
    return Arrays.stream(BaseVersionedStorageFormat.values())
        .filter(
            vsf ->
                vsf.getFormat().equals(metadataV2.format())
                    && vsf.getVersion() == metadataV2.version())
        .findFirst()
        .orElseThrow(
            () -> {
              final String message = "Unsupported RocksDB metadata: " + metadataV2;
              LOG.error(message);
              throw new StorageException(message);
            });
  }
Write to directory.

@param dataDir the data dir
@throws IOException the io exception
plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/configuration/DatabaseMetadata.java