class BootstrapProcessor {

  protected void writeCkptIfAppropriate(BootstrapEventProcessResult result,
                                      BootstrapEventCallback callback,
                                      long numRowsReadFromDb,
                                      Checkpoint ckpt,
                                      String resultSetStmtStr)
  throws SQLException
  {
    assert (null != callback);
    assert (numRowsReadFromDb >= 0);
    assert (null != ckpt);
    if (null != result && !result.isError())
    {
      assert (numRowsReadFromDb >= result.getNumRowsWritten());
      if (result.getNumRowsWritten() > 0)
      {
        callback.onCheckpointEvent(ckpt, _curStatsCollector);
      }
      else if ((result.getNumRowsWritten() == 0) && (numRowsReadFromDb > 0))
      {
        if (!result.isClientBufferLimitExceeded())
        {
          // The first sentence in the log message below is used for an integration test. Please do not change.
          LOG.info("All the rows read from DB have been filtered out by user-level filter. numRowsReadFromDb = "
              + numRowsReadFromDb + " sending checkpoint = " + ckpt);
          callback.onCheckpointEvent(ckpt, _curStatsCollector);
        }
        else
        {
          // pendingEvent header will be set
          LOG.info("There have been rowsReadFromDb that could not be written as the clientBufferLimit has been exceeded. " +
                   "A checkpoint will not be sent, but pendingEvent header will be set. numRowsReadFromDb = " +
                    numRowsReadFromDb + " checkpoint = " + ckpt);
        }
      }
      else
      {
        // For the case of predicatePushDownFilter=true, where no events have been read / none written on channel,
        // result == null and we will not enter this loop. That is, it is not possible that numRowsReadFromDb == 0
        // and result.getNumRowsWritten() == 0
        String errMsg = "This is an error-case that should not happen. First, there were no rows in the resultSet " +
            " Second, this is not a case where all the events have been filtered out. Both of these cannot happen simulateneously. " +
            " Debug information is logged below. " +
            " numRowsReadFromDb = " + numRowsReadFromDb +
            " result = " + result +
            " resultSet statement " + resultSetStmtStr;
        LOG.error(errMsg);
        throw new RuntimeException(errMsg);
      }
    }
  }

  public  BootstrapProcessor(BootstrapServerStaticConfig config,
                            DbusEventsStatisticsCollector curStatsCollector);
  protected  BootstrapProcessor();

}