public void init() {
    try {
      for (Integer oldKey : writeBuffers.keySet()) {
        if (oldKey < Integer.MAX_VALUE) {
          // no one else needs this segment, flush it
          var toFlush = writeBuffers.remove(oldKey);
          if (toFlush != null) {
            toFlush.flushToDisk();
          }
        }
      }
      writeChannel.close();
      readChannel = FileChannel.open(path, READ);
      segmentsArray = ByteBufferUtil.mapFile(readChannel, readChannel.size(), segmentBytes, madvise, usedSegments::get);
    } catch (IOException e) {
      throw new UncheckedIOException(e);
    }
  }
A map from sequential {@code long} keys to {@code long} values backed by a file on disk where the key defines the
offset in the input file.
<p>
During write phase, values are stored in a sliding window of {@link ByteBuffer ByteBuffers} and flushed to disk when
the segment slides out of the window. During read phase, they file is memory-mapped and read.
planetiler-core/src/main/java/com/onthegomap/planetiler/collection/ArrayLongLongMapMmap.java