private void writeToFile(final File file) throws IOException {
    MAPPER.writeValue(
        file,
        new V2(
            new MetadataV2(
                versionedStorageFormat.getFormat(), versionedStorageFormat.getVersion())));
  }
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