code: private long calculateLastCompleted(long index) {
      // Calculate the last completed index as the lowest index acknowledged by all clients.
      long lastCompleted = index;
      for (ServerSessionContext session : executor.context().sessions().sessions.values()) {
        lastCompleted = Math.min(lastCompleted, session.getLastCompleted());
      }
      return lastCompleted;
    }
docs: Calculates the last completed session event index.