/**
   * Creates a new instance of IndexedChronicle as specified by the provided {@link
   * net.openhft.chronicle.ChronicleConfig} and having the specified <tt>basePath</tt> (the base
   * name of the two backing files).
   *
   * @param basePath the base name of the files backing this IndexChronicle
   * @param config the ChronicleConfig based on which the current IndexChronicle should be
   *     constructed
   * @throws FileNotFoundException if the <tt>basePath</tt> string does not denote an existing,
   *     writable regular file and a new regular file of that name cannot be created, or if some
   *     other error occurs while opening or creating the file
   */
  public IndexedChronicle(@NotNull String basePath, @NotNull ChronicleConfig config)
      throws IOException {
    this.basePath = basePath;
    this.config = config.clone();

    File parentFile = new File(basePath).getParentFile();
    if (parentFile != null) {
      parentFile.mkdirs();
    }

    this.indexFileCache =
        VanillaMappedBlocks.readWrite(new File(basePath + ".index"), config.indexBlockSize());
    this.dataFileCache =
        VanillaMappedBlocks.readWrite(new File(basePath + ".data"), config.dataBlockSize());

    findTheLastIndex();
  }