code: public synchronized void writeToCheckpoint(OutputStream output)
        throws IOException, InterruptedException {
      LOG.info("Creating rocksdb checkpoint at {}", mDbCheckpointPath);
      long startNano = System.nanoTime();
  
      CheckpointOutputStream out = new CheckpointOutputStream(output, CheckpointType.ROCKS);
      try {
        // createCheckpoint requires that the directory not already exist.
        FileUtils.deletePathRecursively(mDbCheckpointPath);
        mCheckpoint.createCheckpoint(mDbCheckpointPath);
      } catch (RocksDBException e) {
        throw new IOException(e);
      }
      LOG.info("Checkpoint complete, creating tarball");
      TarUtils.writeTarGz(Paths.get(mDbCheckpointPath), out);
      LOG.info("Completed rocksdb checkpoint in {}ms", (System.nanoTime() - startNano) / 1_000_000);
      // Checkpoint is no longer needed, delete to save space.
      FileUtils.deletePathRecursively(mDbCheckpointPath);
    }
docs: Writes a checkpoint of the database's content to the given output stream.
  
  @param output the stream to write to